-
-
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
bug: useAlternatePageUtils generates the wrong links in LocaleDropdownNavbarItem when baseUrl is "/docs/" #9514
Comments
Do you have |
We don't have |
You should definitely choose either Thanks for the clear repro. If I have time, I'll check this later. Otherwise someone else might as well. |
Hmmm, this is not the first time we see issues like this.
Serving When you navigate back to your homepage the trailing slash is there this time (as Docusaurus expects) and the issue does not happen. Note, you have rewrites/redirects on your Vercel config here: https://github.com/ionic-team/ionic-docs/blob/main/vercel.json It's difficult for me to figure out the purpose of this config: {
"redirects": [
{ "source": "/", "destination": "/docs" }
],
"rewrites": [
{ "source": "/docs", "destination": "/" },
{ "source": "/docs/:match*", "destination": "/:match*" }
]
} And this could be the cause of your problem. I can't really troubleshoot this for you, but I'm pretty sure the issue is that you shouldn't serve your site from And apparently you altered the default Vercel behavior and made it unable to serve it from CF my resource here: It shows that Vercel by default is able to serve My intuition is that your Ionic website is an assembly of multiple Vercel deployments at CDN level. I mean your main site and your docs are not the same Vercel deployment right? This makes it even more complicated to troubleshoot for me because it's a quite advanced setup and I only see a part of it. My recommendation would be to try to deploy your docs to a brand new Vercel deployment, without any Vercel config or fancy setup. If it works, then Docusaurus is not the problem, but your custom setup is. I'm pretty sure this is the case because your deploy previews are able to serve from
|
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
The repro was recently upgraded to the latest v2. It's been noticed that the link to the JP site is broken since it’s now directing to https://ionicframework.com/docs/ja//docs (note the /docs at the end). This issue is happening to all the links within
LocaleDropdownNavbarItem
and only in production.The
baseUrl
indocusaurus.config.js
has been set to/docs/
. The repro is being hosted on Vercel. Lastly, this is only happening if the URL does not have a trailing slash.The extra
/docs
is being appended through theuseAlternatePageUtils
.getLocalizedBaseUrl
returns/docs/ja
and thenpathnameSuffix
is still/docs
which is why I get the extra/docs
at the end.The generated links are:
EN:
/docs//docs
JP:
/docs/ja//docs
repro: https://ionicframework.com/docs
GitHub: https://github.com/ionic-team/ionic-docs
Reproducible demo
https://github.com/ionic-team/ionic-docs
Steps to reproduce
/docs/ja//docs
docs
: https://ionicframework.com/docs/ja/docs/docs/ja/
docs
: https://ionicframework.com/docs/ja/This also happens for EN:
/docs//docs
docs
: https://ionicframework.com/docs/docs/docs/
docs
: https://ionicframework.com/docs/(This can't be reproduced locally)
Expected behavior
I expect the locales links to not include an extra
docs
regardless if there's a trailing slash or not.The generated links should be:
EN:
/docs
JP:
/docs/ja
Actual behavior
The locales links add an extra
docs
.The generated links are:
EN:
/docs//docs
JP:
/docs/ja//docs
Your environment
Self-service
The text was updated successfully, but these errors were encountered: