Have you read the Contributing Guidelines on issues?
Prerequisites
Description
If a route is created for the base locale but not for i18n ones, e.g. like the bug in #5553—well, not exactly a bug, just an inconsiderate move by the plugin author, going from the non-existent i18n route back to the base locale results in the full domain from being erased.
This is related to how we test what's a "fully qualified" domain:
|
function createUrl({ |
|
locale, |
|
fullyQualified, |
|
}: { |
|
locale: string; |
|
// For hreflang SEO headers, we need it to be fully qualified (full protocol/domain/path...) |
|
// For locale dropdown, using a path is good enough |
|
fullyQualified: boolean; |
|
}) { |
|
return `${fullyQualified ? url : ''}${getLocalizedBaseUrl( |
|
locale, |
|
)}${pathnameSuffix}`; |
|
} |
Steps to reproduce
- Create a plugin, and add a route to only the base locale.
async contentLoaded({actions}) {
actions.addRoute({
path: '/feature-requests',
exact: false,
component: '@site/src/featureRequests/FeatureRequestsPage',
});
},
- Go to http://docusaurus.io/zh-CN/feature-requests, and see the 404.
- Go back to the base locale through the locale dropdown.
Expected behavior
I'm taken to http://docusaurus.io/feature-requests, regardless if this page exists or not.
Actual behavior
I'm taken to http://feature-requests, an absolutely absurd URL to be in.
Your environment
- Public source code:
- Public site URL:
- Docusaurus version used:
- Environment name and version (e.g. Chrome 89, Node.js 16.4):
- Operating system and version (e.g. Ubuntu 20.04.2 LTS):
Reproducible demo
No response
Self-service
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clearoryarn clearcommand.rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages.Description
If a route is created for the base locale but not for i18n ones, e.g. like the bug in #5553—well, not exactly a bug, just an inconsiderate move by the plugin author, going from the non-existent i18n route back to the base locale results in the full domain from being erased.
This is related to how we test what's a "fully qualified" domain:
docusaurus/packages/docusaurus-theme-common/src/utils/useAlternatePageUtils.ts
Lines 43 to 55 in 1e1df74
Steps to reproduce
Expected behavior
I'm taken to http://docusaurus.io/feature-requests, regardless if this page exists or not.
Actual behavior
I'm taken to http://feature-requests, an absolutely absurd URL to be in.
Your environment
Reproducible demo
No response
Self-service