One url per locale? Multi-domain deployment. #7854
Replies: 1 comment
-
|
@ahtremblay we should be able to customize the config according to the current locale, but don't have a good API for that ATM, and the original design of the config does not really permit to add it easily without a breaking change or a weird API design. The only workaround I can suggest is to run multiple builds using different environment variables. And then use const config = {
url: process.env.CURRENT_DOCUSAURUS_LOCALE === "fr" ? 'https://www.bonjour.com' : 'https://www.hello.com',
i18n: {
defaultLocale: 'en',
locales: ['en', 'fr']
},
}At best we'll provide this env variable automatically for you, or find a way to make the current locale available in the config file. The weird issue is that we have to load the config file once first without any "current locale", just because we actually need to read the i18n config and default locale 😅 ) Please let me know if this works for you. Note I'd like to move the Docusaurus i18n sites to subdomains later, just for the sake of demonstrating this setup is technically possible. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, it does not seem possible to set one url for each locale.
For instance, I may wish to deploy the
frlocal tohttps://www.bonjour.comand theenlocale tohttps://www.hello.com, butdocusaurus.config.jsonly allows to specify a singleurlfor the whole project. Is there a workaround?The relevant parts of my config file are:
I compile using a build.sh script as follows:
However, the links in the generated files all point to
https://www.hello.comregardless of the locale. How can I make the url for thefrlocale point tohttps://www.bonjour.com? The sitemap.xml also containshttps://www.hello.comfor thefrlocale.Beta Was this translation helpful? Give feedback.
All reactions