Trailing slash option
See original GitHub issueHeyo 👋
it’d be great to have an option for adding/removing trailing slashes for routes coming from localePath
. A global setting would suffice IMO and could be applied around the marked lines.
trailingSlashes: true
/abc/
-> /abc/
(keeps the same)
/abc
-> /abc/
(changes)
trailingSlashes: false
/abc
-> /abc
(keeps the same)
/abc/
-> /abc
(changes)
trailingSlashes: undefined
(default)
/abc/
-> /abc/
(keeps the same)
/abc
-> /abc
(keeps the same)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:12 (4 by maintainers)
Top Results From Across the Web
What is a trailing slash? - Ryte Wiki
A trailing slash is the forward slash placed at the end of a URL. The trailing slash is generally used to mark a...
Read more >Integrated handling of trailing slashes in Gatsby #34205
Introduce the option to force trailing slashes for all routes (including client routes) likely through a config setting in gatsby-config.js ...
Read more >Trailing Slashes and Gatsby - Jon
The reason I say that Gatsby implies we should use trailing slashes is because Gatsby directory-izes path s you give to createPage() ....
Read more >Should You Have a Trailing Slash at the End of URLs? - Ahrefs
A trailing slash is a forward slash (“/”) placed at the end of a URL such as domain.com/ or domain.com/page/. But should you...
Read more >gatsby-plugin-force-trailing-slashes
A web-server that treats trailing-slash paths as directories with an index.html inside and non-trailing-slash paths as named documents (and ideally redirects ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, @manniL! Solved since Nuxt v2.10.0 👏
I think, that what @timothymarois meant, was that when you set
trailingSlashes: false
option in Nuxtrouter
settings, there is this weird behavior: Suppose I useprefix
strategy and have 2 locales:pl
anden
. When I go into/pl
I am redirected to/pl/
(slash added) and get 404, since trailing slashes are disabled. A workaround would be to settrailingSlashes: undefined
. In that case/pl
is still redirected to/pl/
, but this time it works (since trailing slash is optional). But this may be not good in terms of SEO.