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
Map custom routes to components? #2598
Comments
@jmknoll – The blog posts on my website, for example, get their URLs from a Those files are then looped over and |
Yeah, you either create routes manually with |
Thanks @danoc, hadn't found that in the docs. |
I came across this issue as a top search result for searching how to create custom routes for components. My use case was to have a custom route for src/pages/tags.js be /blog/tags instead of /tags, like gatsbyjs.org's blog has. I was trying to go the createPage route and then came across an easier way by looking at a 404 debug message from Gatsby, which I think it suggested. I just had to create a /src/pages/blog/ path and put tags.js inside that. Then my path became /blog/tags as I wanted. Hope this helps someone. |
I'm generally a big fan of Gatsby's automagical routing. However, there are situations where I think it would be beneficial to map custom urls to particular components, like how its done by react-router, rather than airing my file structure for the entire internet to see.
Or is this already possible, and I'm just missing it?
The text was updated successfully, but these errors were encountered: