Next.js Discord

Discord Forum

Domain routing i18n adds default locale to link href's

Unanswered
Western yellowjacket posted this in #help-forum
Open in Discord
Avatar
Western yellowjacketOP
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/nice-bose-p9y9lt?workspaceId=8c42ce9b-a788-4790-894d-50229e1eadea

To Reproduce
The codesandbox is a simplified setup of our site and config. This should be run with domain routing.

Current vs. Expected behavior
In the example code, the link components that are resolved on the server, get the default locale as an infix. An example of where this happens is on diamondsbyme.com/rings/. The menu and product links are structured as a relative link with the locale, even if it is the default locale (en) for that domain, resulting in the link being https://www.diamondsbyme.com/en/rings/.


This should just resolve to https://www.diamondsbyme.com/rings/ on the server, as it did previously. On previous deployments this behavior wasn't present. When the link is resolved via client side routing, the default locale is not present in the href. This can be tested on the example link by navigating via the menu to, for example, “Men's rings”. The products will change and not have the default locale infix in the href, it even is the complete URL.

Refreshing the page will include the default locale again as a relative link.

I've downgraded to 14.2.10 and even to 14.2.3 but the issue still persists.

0 Replies