-
Notifications
You must be signed in to change notification settings - Fork 215
Document per-page locale links feature #2801
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,6 +129,62 @@ | |
| } | ||
| ``` | ||
|
|
||
| ### External URLs for language switcher | ||
|
|
||
| For multi-domain documentation setups where different locales are hosted on separate domains, you can configure external URLs in the language switcher. This is useful when not all pages exist in all locales or when you maintain separate documentation sites per region. | ||
|
|
||
| Configure default external URLs in your `docs.json`: | ||
|
|
||
| ```json docs.json | ||
| { | ||
| "navigation": { | ||
| "global": { | ||
| "languages": [ | ||
| { | ||
| "language": "en", | ||
| "default": true, | ||
| "href": "https://developers.example.com/docs" | ||
| }, | ||
| { | ||
| "language": "de", | ||
| "href": "https://developers.example.de/docs" | ||
| }, | ||
| { | ||
| "language": "fr", | ||
| "href": "https://developers.example.fr/docs" | ||
| }, | ||
| { | ||
| "language": "es", | ||
| "href": "https://developers.example.es/docs" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| #### Per-page locale links | ||
|
|
||
| Override the default language switcher URLs for specific pages using frontmatter. This allows you to link directly to the translated version of the current page instead of the homepage. | ||
|
|
||
| Add locale-specific links to your page frontmatter using the pattern `{language_code}_link`: | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth a quick sentence on the fallback behavior when a |
||
| ```mdx api-reference/introduction.mdx | ||
| --- | ||
| title: "API Introduction" | ||
| description: "Get started with our API" | ||
| de_link: "https://developers.example.de/docs/api-reference/introduction" | ||
| fr_link: "https://developers.example.fr/docs/api-reference/introduction" | ||
| es_link: "https://developers.example.es/docs/api-reference/introduction" | ||
| --- | ||
| ``` | ||
|
|
||
| When a user switches languages on this page, they will be directed to the specific translated page URL instead of the default `href` configured in `docs.json`. This is particularly useful for: | ||
|
Check warning on line 182 in guides/internationalization.mdx
|
||
|
|
||
| - Multi-domain documentation where each locale has its own domain | ||
| - Documentation sites where not all pages are translated | ||
| - Linking to equivalent pages across different documentation systems | ||
|
|
||
| ## Maintain translations | ||
|
|
||
| Keep translations accurate and synchronized with your source content. | ||
|
|
@@ -181,9 +237,9 @@ | |
| --- | ||
| ``` | ||
|
|
||
| ### hreflang tags | ||
|
|
||
| Mintlify automatically generates hreflang tags for each language version of your documentation to help search engines understand the relationships between translated pages. | ||
|
|
||
| ## Best practices | ||
|
|
||
|
|
@@ -191,7 +247,7 @@ | |
|
|
||
| Consider locale-specific formatting for dates and numbers. | ||
|
|
||
| - Date formats: MM/DD/YYYY vs DD/MM/YYYY | ||
|
Check warning on line 250 in guides/internationalization.mdx
|
||
| - Number formats: 1,000.00 vs 1.000,00 | ||
| - Currency symbols: $100.00 vs 100,00€ | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor clarity: there are now two different
languagesarrays (navigation.languagesvsnavigation.global.languages); calling that out here helps avoid confusion.