-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relative require from frontmatter #539
Comments
The very quick answer is to create a context module with all your images in them and then in your md wrapper reference the filepath to pull in the image path. https://webpack.github.io/docs/context.html I might add this to the blog starter soon as it's a pretty common request. I'll add an actual code sample when I have time or just add it to the blog starter. |
This should be covered in 1.0 I would think. Closing unless you have anything else. |
@chrisdmacrae Hi, I'm also facing similar issue. Did you resolved it ? |
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?
The text was updated successfully, but these errors were encountered: