Skip to content

Relative require from frontmatter #539

@chrisdmacrae

Description

@chrisdmacrae

Including images in the markdown automatically resolves the images in the rendered component. However, including an image in the frontmatter simply passes the string to the template, page, component, etc.

I am using a component to render a list of pages, and I want an image stored relative to the md file that is specified in the frontmatter to be rendered by the component without having to hardcode the path resolving logic into the component (trying to keep it DRY).

Is there a good way of resolving the relative filepath to a rendered page so that I can require the image in the development bundle?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions