Skip to content

Enhancement: Add setting for enforcing relative image paths #282

Closed
@rolule

Description

@rolule

Is your feature request related to a problem? Please describe.
I am using Front Matter with the Gatsby framework and MDX files. My folder structure looks basically identical to the "Page and leaf bundles" example (except I use MDX files). When I add an image located in the same folder as the the index.mdx file, Front Matter always adds the absolute path to the image (/content/posts/leaf-bundle/image1.jpg) instead of the much shorter relative path (./image1.jpg). However, Gatsby MDX does not seem to support absolute image paths out of the box, so it fails creating the post when it encounters the image url.

Describe the solution you'd like
I would love a setting that forces relative paths when adding images through Front Matter. In the example above, the path would then be only the image's file name and not the full absolute path. It should also apply to sibling leaf-nodes (../leaf-bundle-2/image2.jpg). This would make resolving (image) files in the same directory much easier in Gatsby, but I am sure this also applies to other frameworks as well.

Describe alternatives you've considered
The alternative would be to find a Gatsby workaround for this, which I could not find yet unfortunately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions