-
Notifications
You must be signed in to change notification settings - Fork 27.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
Locale routing is broken on /{locale}/[param] if param is a locale #21714
Comments
@emil-wearealldigital Did you find a workaround for this routing problem ? I found the same issue and this gave me some important SEO problems. |
Update for Next.js 12 I tested it on the newest release and the bug is still present. The good thing is that all my additional examples are obsolete. The router behaves better and it shows warnings for invalid usage. |
sounds like a duplicate of an older bug #21210 workaround via redirects possible: #31420 (comment) |
Also see the same issue. We have two locales
So the initial rendering is correct. But when I click the link, Next downloads serverside props for Adding locale={router.locale} to doesn't fix the issue. As a workaround we use following href rewrite for all 's:
|
What version of Next.js are you using?
10.0.6 (Updated my report to 12.0.4)
What version of Node.js are you using?
14.15.0
What browser are you using?
Chrome
What operating system are you using?
Windows
How are you deploying your application?
next start
Describe the Bug
Having a localized dynamic route like
/{locale}/[param]
is broken when the provided[param]
is a locale. This brings more bugs which I've provided examples for in the repository below.Expected Behavior
Going to
/{locale}/[param]
should always point to[param].js
and it shouldn't matter if[param]
is a locale.To Reproduce
next.config.js
index.js
[param].js
/{locale}/{locale}
(e.g./de/fr
) to reproduce the bug.Edit: The examples below are not applicable to Next.js 12.
I've provided 2 more examples of a real life situation showing how the router breaks because of this:Check the repository for example
The first one is mainly a routing bug - going forward and back shows unexpected pathnames.The second one is more like a confusion after the previous issues - it just shows how it's possible to decorate the pathname in a wrong way (possibly not a bug).
Edit: I've added a 3rd example which really breaks the app. If you add SSR then it's possible to execute another component without rendering it.
The text was updated successfully, but these errors were encountered: