-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Problems with locale url on homepage and blog #10078
Comments
Instead of providing complex repro instructions that I need to reproduce on my side, please provide a runnable https://docusaurus.new/stackblitz repro. This way we'll be 100% sure we are talking about the same thing, it's more reliable than a wall of text and we save time. Until a repro is provided, it looks more like a support request/question. I'm closing because many sites use i18n successfully already. Please:
|
Hello ! Sorry for the complex repro instructions, indeed it is much easier with a runnable repro. You will find below the elements you requested: Runnable reprohttps://stackblitz.com/edit/github-wgjn8a Commands to run on the repro and steps to reproduce
Actual behaviorOn the page Expected behaviorOn the page If you need other elements let me know ! |
Thanks, that's a legit bug due to building multiple locales under a baseurl ( What I see in practice is that That's probably a bug in our I'll fix it |
Thank you for your answer and the explanations ! I will try first to deploy my project to a CDN to see the result and come back to you If there is still this bug I will use Thanks in advance for investigating ! |
Will be fixed in #10090 and you'll be able to test it in the next canary release |
Just a little update on my side : I confirm that multiple locales works well when deployed to a CDN with Thanks again for the help ! |
thanks for reporting 👍 |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
I followed the documentation on the docusaurus website to add an i18n locale dropdown. By default my website is in French and I'm trying to implement an English translation. When I serve locally the built version of my project I have some problems with switching locale on either the homepage or the blog section depending on my docusaurus.config.js configuration. (see in steps to reproduce)
Reproducible demo
No response
Steps to reproduce
Here is a piece of my configuration in my file docusaurus.config.js :
And a quick overview of my project (folders /docs/, /blog/ and /i18n/)
When I serve locally the built version of my project I have the following problems :
if I set
trailingSlash: false
:On the homepage, anytime the english button on the dropdown is clicked it tries to go to /user-doc/en/ but I have a status 302 and I am directly redirected to /user-doc/
But if I go to /user-doc/en, I works but after the dropdown is broken... In debug thhe url on French looks like this /user-doc//user-doc/en and if I click on it I have a status 301 and I am getting redirected to /user-doc/en
On every other pages the dropdown is working.
if I set
trailingSlash: undefined
ortrailingSlash: true
:When I am on the blog section (ex : /user-doc/blog/release-notes/1.1), anytime the english button on the dropdown is clicked it tries to go to the /user-doc/en/blog/release-notes/1.1 page and it shows the custom 404 and when you click it again it routes to /user-doc/en/en//blog/release-notes/1.1 and it keeps appending /en/ at the beginning of the url.
With this configuration on every other pages the dropdown is working.
I have been searching a lot on bug reports on your GitHub, on Stackoverflow and also on the Docusaurus documentation but I can't find why it's behaving like this.
Any ideas what could be causing the problem?
Thanks in advance for your help !!!
Expected behavior
if I set
trailingSlash: false
:On the homepage, anytime the english button on the dropdown is clicked it would great to go to /user-doc/en/ and that the page /user-doc/en/ works
Actual behavior
if I set
trailingSlash: false
:On the homepage, anytime the english button on the dropdown is clicked it tries to go to /user-doc/en/ but I have a status 302 and I am directly redirected to /user-doc/
Your environment
Self-service
The text was updated successfully, but these errors were encountered: