diff --git a/components/banner.mdx b/components/banner.mdx index cc8228eb7..1e14c1fff 100644 --- a/components/banner.mdx +++ b/components/banner.mdx @@ -39,4 +39,54 @@ To add a banner, use the `banner` property in your `docs.json`: Whether users can dismiss the banner. When `true`, users can close the banner and it won't reappear for their session. Defaults to `false`. - \ No newline at end of file + + +## Language-specific banners + +Configure different banner content for each language in your documentation. Define language-specific banners in the `navigation.languages` array in your `docs.json`. + +```json +{ + "navigation": { + "languages": [ + { + "language": "en", + "banner": { + "content": "🚀 Version 2.0 is now live! See our [changelog](/en/changelog) for details.", + "dismissible": true + }, + "groups": [ + { + "group": "Getting started", + "pages": ["en/overview", "en/quickstart"] + } + ] + }, + { + "language": "es", + "banner": { + "content": "🚀 ¡La versión 2.0 ya está disponible! Consulta nuestro [registro de cambios](/es/changelog) para más detalles.", + "dismissible": true + }, + "groups": [ + { + "group": "Getting started", + "pages": ["es/overview", "es/quickstart"] + } + ] + } + ] + }, + "banner": { + "content": "🚀 Version 2.0 is now live!", + "dismissible": true + } +} +``` + +### Fallback behavior + +Banners follow a priority order when determining which content to display: + +1. **Language-specific banner**: If the current language has a `banner` configuration, it takes priority. +2. **Global banner**: If no language-specific banner exists, display the global `banner`. \ No newline at end of file diff --git a/organize/navigation.mdx b/organize/navigation.mdx index 459b1661a..f38c3413d 100644 --- a/organize/navigation.mdx +++ b/organize/navigation.mdx @@ -511,7 +511,7 @@ Partition your navigation into different languages. Languages are selectable fro alt="Decorative graphic of a language switcher." /> -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. +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. We currently support the following languages for localization: @@ -550,6 +550,10 @@ We currently support the following languages for localization: "languages": [ { "language": "en", + "banner": { + "content": "🚀 Version 2.0 is now live! See our [changelog](/en/changelog) for details.", + "dismissible": true + }, "groups": [ { "group": "Getting started", @@ -559,6 +563,10 @@ We currently support the following languages for localization: }, { "language": "es", + "banner": { + "content": "🚀 ¡La versión 2.0 ya está disponible! Consulta nuestro [registro de cambios](/es/changelog).", + "dismissible": true + }, "groups": [ { "group": "Getting started",