-
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
Path rewrite #383
Comments
Ok, seems like Gatsby automatically rewrites the path if the page has a metadata field "path". This should really be documented somewhere! |
You can also programatically rewrite paths by exporting a
See my blog for an example https://github.com/KyleAMathews/blog/blob/master/gatsby-node.js |
Would be really cool if some documentation would be added for Btw, your blog no longer seems to be using |
Can something like next.js approach be implemented? |
@digitaldiy and others this is a very old issue from pre Gatsby-v1 :-D Generally speaking there's two options — |
Is there a simple way to achieve the code below (next.js), the reason being is that one treatment can have loads of categories but the page is exactly the same so there's no point in duplication but rather a rewrite so people can still see the category/treatment in the search bar but be taken to the right page, this is super useful for categorisation in general ( think how amazon has there departments but products are in loads of categories at the same time but are still listed under the categories you clicked on. Thanks in advance. async rewrites() { |
Yes, those are redirects. We don't have a way to bulk match the source/destination but you can create redirects for each page while you're creating the pages as well https://www.gatsbyjs.com/docs/reference/config-files/actions/#createRedirect |
Thanks for the link ill go through that now, may I ask if there Is plans to implement a system like this in the feature ( say Gatsby 5), thanks for your help |
For some pages, I want to to change the URL path in the router to not map directly to the path on the filesystem.
For example: a blog post in a file "blog/2015-01-01-post-title" should have a path "blog/post-title".
Where can I hook into the route building process to change that?
The text was updated successfully, but these errors were encountered: