Currently, gatsby-transformer-javascript-frontmatter doesn鈥檛 warn when gatsby-source-filesystem isn鈥檛 configured; instead, it just fails silently.
To fix this, we need to:
gatsby-source-filesystem to peerDependencies in gatsby-transformer-javascript-frontmatter to warn developers if they鈥檝e left it outPlugin config example:
module.exports = {
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `pages`,
path: `${__dirname}/src/pages/`
}
},
'gatsby-transformer-javascript-frontmatter'
]
}
This would make a great first issue for someone!
@jlengstorf thanks for being so on top of things! I was actually aware of the gatsby-source-filesystem requirement and I'm able to query the frontmatter using the plugin. It's definitely a good idea to add what you've listed though.
The problem I'm having is that I can't figure out how to connect the queried data to pages that are using the javascript files that have frontmatter. I have pages that are generated by other source plugins and they're using a javascript template that has frontmatter. I can't figure out for the life of me how to actually use the frontmatter in a page though. I'm wanting to pass the frontmatter to page context in gatsby node but following the tutorials and reading the guides doesn't help me unfortunately.
I would like to tackle this one, if that's okay @jlengstorf :)
This issue was opened based on my comment in another issue but this issue doesn't actually solve the problem I was having there. Should this be closed? Should I open a different issue?
@TylerBarnes I think it might be worth opening a new issue or asking @DSchau on Discord. This issue isn't really scoped for the problem you're describing, so we should get something open to capture it directly.
@jlengstorf thanks again for all the awesome support you guys are doing! I ended up learning how to use the context api and realized it makes much more sense for what I'm trying to do.
A Gatsby example of using javascript frontmatter in combination with another source plugin still might be helpful for someone in the future though.
@TylerBarnes could you share your final code with me? I'd love to see how you're using the Context API for page transitions.
@jlengstorf I spent a bunch of time on it over the weekend and I'm packaging up a demonstration plugin as a kind of working proof of concept. I'll post it up for you once I get something worth looking at.