Skip to content

Commit 8fe299b

Browse files
Document language-specific banner feature (#2544)
* Update components/banner.mdx Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * Update organize/navigation.mdx Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * Update organize/navigation.mdx Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * Apply suggestions from code review * Apply suggestion from @ethanpalm * Apply suggestion from @ethanpalm * Apply suggestion from @ethanpalm * Apply suggestion from @ethanpalm --------- Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> Co-authored-by: Ethan Palm <[email protected]>
1 parent be513d4 commit 8fe299b

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

components/banner.mdx

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,54 @@ To add a banner, use the `banner` property in your `docs.json`:
3939

4040
<ResponseField name="dismissible" type="boolean">
4141
Whether users can dismiss the banner. When `true`, users can close the banner and it won't reappear for their session. Defaults to `false`.
42-
</ResponseField>
42+
</ResponseField>
43+
44+
## Language-specific banners
45+
46+
Configure different banner content for each language in your documentation. Define language-specific banners in the `navigation.languages` array in your `docs.json`.
47+
48+
```json
49+
{
50+
"navigation": {
51+
"languages": [
52+
{
53+
"language": "en",
54+
"banner": {
55+
"content": "🚀 Version 2.0 is now live! See our [changelog](/en/changelog) for details.",
56+
"dismissible": true
57+
},
58+
"groups": [
59+
{
60+
"group": "Getting started",
61+
"pages": ["en/overview", "en/quickstart"]
62+
}
63+
]
64+
},
65+
{
66+
"language": "es",
67+
"banner": {
68+
"content": "🚀 ¡La versión 2.0 ya está disponible! Consulta nuestro [registro de cambios](/es/changelog) para más detalles.",
69+
"dismissible": true
70+
},
71+
"groups": [
72+
{
73+
"group": "Getting started",
74+
"pages": ["es/overview", "es/quickstart"]
75+
}
76+
]
77+
}
78+
]
79+
},
80+
"banner": {
81+
"content": "🚀 Version 2.0 is now live!",
82+
"dismissible": true
83+
}
84+
}
85+
```
86+
87+
### Fallback behavior
88+
89+
Banners follow a priority order when determining which content to display:
90+
91+
1. **Language-specific banner**: If the current language has a `banner` configuration, it takes priority.
92+
2. **Global banner**: If no language-specific banner exists, display the global `banner`.

organize/navigation.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ Partition your navigation into different languages. Languages are selectable fro
511511
alt="Decorative graphic of a language switcher."
512512
/>
513513

514-
In the `navigation` object, `languages` is an array where each entry is an object that requires a `language` field and can contain any other navigation fields.
514+
In the `navigation` object, `languages` is an array where each entry is an object that requires a `language` field and can contain any other navigation fields, including language-specific banner configurations.
515515

516516
We currently support the following languages for localization:
517517

@@ -550,6 +550,10 @@ We currently support the following languages for localization:
550550
"languages": [
551551
{
552552
"language": "en",
553+
"banner": {
554+
"content": "🚀 Version 2.0 is now live! See our [changelog](/en/changelog) for details.",
555+
"dismissible": true
556+
},
553557
"groups": [
554558
{
555559
"group": "Getting started",
@@ -559,6 +563,10 @@ We currently support the following languages for localization:
559563
},
560564
{
561565
"language": "es",
566+
"banner": {
567+
"content": "🚀 ¡La versión 2.0 ya está disponible! Consulta nuestro [registro de cambios](/es/changelog).",
568+
"dismissible": true
569+
},
562570
"groups": [
563571
{
564572
"group": "Getting started",

0 commit comments

Comments
 (0)