Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: +8.83 kB (+0.08%) Total Size: 11.5 MB
ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
|
Size Change: +9.29 kB (+0.08%) Total Size: 11.9 MB
ℹ️ View Unchanged
|
…rl' into slorber/i18n-localeConfigs-baseUrl
i18n.localeConfigs[locale].baseUrl config optioni18n.localeConfigs[locale].{url,baseUrl} config options
…ains, wire the new per-locale url param
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
This was referenced Jul 28, 2025
i18n.localeConfigs[locale].{url,baseUrl} config optionsi18n.localeConfigs[locale].{url,baseUrl} config options, fix multi-domain deployments
This was referenced Jul 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fix #4723
Fix #6462
Fix #6075 (comment)
Supersede #6731
This PR permits improving the i18n support for deploying an i18n site, in particular in more complex and multi-domain deployments.
We already had these:
url: The url/domain of your sitebaseUrl: The baseUrl of your site's main locale, also used as a base for localized sites hosted under subpaths like/<baseUrl>/<locale>/This introduces:
i18n.localeConfigs[locale].url: The url/domain of your site for a given localei18n.localeConfigs[locale].baseUrl: The baseUrl of your site for a given localeProblems
Until now, Docusaurus had heuristics to automatically infer the "final baseUrl" of a localized site, based on the global
siteConfig.baseUrlattribute:/<baseUrl>/for the default locale/<baseUrl>/<locale>/for other locales, hosted under subpaths/<baseUrl>/for all locales when building a single locale at a time (docusaurus build --locale fr), assuming a multi-domain deployment.This works well for most sites, but does not really give enough flexibility.
For example, what if you don't want your default locale to be hosted at the site root, but want a consistent
/<locale>/prefix?Also the previous implementation was buggy for multi-domain setups because there was no way to tell Docusaurus what the domains are for each locale. These features didn't work well:
hreflangmeta used for crawlers like Google to detect localized variants of a given page.With the new options, it's possible to give more flexibility and pass a custom
url/baseUrlfor each locale, giving you the ability to override the default values based onsiteConfig.urlandsiteConfig.baseUrl.The existing heuristics have been kept as-is for retrocompatibility, but can now be overridden.
Test Plan
Unit tests
Many local tests
Using our current website config:
yarn workspace website build: producesbuildandbuild/fr(+ other locales), can be served properly, has right canonical URL and hreflang metayarn workspace website build --locale en --locale fr: same resultyarn workspace website build --locale fr: builds/serve fine, outputs inbuild, has correct hreflang metaUsing a custom config on our website:
yarn workspace website build: works wellyarn workspace website build --locale en --locale fr: works wellyarn workspace website build --locale fr: works wellTest links
Preview: https://deploy-preview-11316--docusaurus-2.netlify.app/
Docs:
Related issues/PRs
Supersede #6731