-
-
Notifications
You must be signed in to change notification settings - Fork 483
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
Trailing slash option #422
Comments
Being a slightly old dog that worked on pages before frameworks and SPAs, it strikes me as wrong as routes with and without slash can be different routes in Apache for example (one is a file and other a directory with index file). I guess these days that distinction can be blurry (and for less confusion, maybe should be) so I'm not entirely against an option. That is, as long as with Nuxt (and VueRouter) there is always guarantee that those will be handled the same. I'm a bit concerned that it might not be the case... |
You are right, "back then" the distinction was exactly that. a folder (+ index) or a file. Nowadays it doesn't matter a lot and these usually aren't different routes. One variant should be the main one (for SEO purposes, canonical URLs and so on) though. Also, it'd be a bad experience for the user if /dogs/ puts out sth. different than /dogs. Vue router handles both kinds equally by default, except if you are enabling strict mode in the vue router "manually", but you'd only do that if you know what you are doing. |
OK, then it makes sense. I do wonder now if it would make more sense for Nuxt to handle that though... If trailing slashes would be added by Nuxt and it would also add (I've tested that with some quick hacking and seen it working albeit with some issues when redirecting. But that is probably separate issue in nuxt-i18n.) |
I've actually thought about the same |
There we go nuxt/nuxt#6331 |
I was just asking this in https://cmty.app/nuxt/nuxt.js/issues/c9751 a few days ago. Any workarounds for v2.9.x ? |
@dacxjo I'd suggest to upgrade to nuxt-edge if you really need that feature right now Ofc you can implement it on your own if you want. You can check what I did in the related PR and mimic that. |
Got it, thanks @manniL |
Thanks, @manniL! Solved since Nuxt v2.10.0 👏 |
|
If you have a specific problem then report an issue with all the details. There is an infinite number of configurations possible (starting from configuration options through different ways of building and deploying) so there is always a chance that some have issues. Saying "it doesn't work" won't help anyone. |
I think, that what @timothymarois meant, was that when you set |
Heyo 👋
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.https://github.com/nuxt-community/nuxt-i18n/blob/617e31e8235ffdeb7d345c3b960701b616d94b72/src/plugins/routing.js#L47-L48
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)The text was updated successfully, but these errors were encountered: