Provide a trailing slash option #31372
-
Browsers and bots treat pages with and without trailing slashes as unique pages (e.g. This makes it easy to accidentally create multiple versions of pages in search engine's crawls of your site. @jon-sully has a good overview of the problem and possible current approaches to solving it https://jonsully.net/blog/trailing-slashes-and-gatsby/ There are popular Gatsby plugins to both remove slashes and add them. The approach these plugins take has the shortcoming that they can only control the paths that are created at build-time. There's no way to force slash or no slash for links created with the So we should handle this at the framework level and give people the option to force all links to include/disclude slashes and handle this at build & runtime. For build-time, we would modify the It's also common to want to enforce link creation in markdown or CMSs but this seems difficult to influence from within Gatsby. Previous explorations: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is now released in Gatsby 4.7: https://www.gatsbyjs.com/docs/reference/release-notes/v4.7/#trailingslash-option |
Beta Was this translation helpful? Give feedback.
This is now released in Gatsby 4.7: https://www.gatsbyjs.com/docs/reference/release-notes/v4.7/#trailingslash-option