From 611a7ea3d45febb5c176ad26eae4506889fb62b2 Mon Sep 17 00:00:00 2001 From: Kai Stierl Date: Mon, 13 Apr 2020 21:52:40 +0200 Subject: [PATCH 1/2] exclude current lang in navbar, better alignment, use languageName * exclude the currently used language to yield space in the navbar * improve button optics and alignment in menu bar and collapsed menu * use long language name as button text to make it more user friendly * update documentation --- exampleSite/content/docs/multilingual/content.md | 7 ++++++- layouts/partials/fragments/nav.html | 10 ++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/exampleSite/content/docs/multilingual/content.md b/exampleSite/content/docs/multilingual/content.md index 14a0cf83..0c7784e5 100644 --- a/exampleSite/content/docs/multilingual/content.md +++ b/exampleSite/content/docs/multilingual/content.md @@ -23,16 +23,18 @@ for German website if those pages are not translated to German. For more information on Hugo's Multilingual mode, please refer to [their documentation](https://gohugo.io/content-management/multilingual/). In order to configure two languages, you need to update your main your -configuration. Here's an example from the official documentation: +configuration. Here's an example, derived from the official documentation: ``` DefaultContentLanguage = "en" [languages] [languages.en] + languageName = "English" title = "My blog" weight = 1 [languages.fr] + languageName = "Français" title = "Mon blogue" weight = 2 @@ -40,6 +42,9 @@ DefaultContentLanguage = "en" ... ``` +The `languageName` parameter is used as text on the language switcher buttons +in the navbar. + Please note that these parameters are added outside of `params` variable, inside your configuration file (`config.toml`, `config.yaml`, `config.json`). This will let Hugo know that there are two languages for this project and the default diff --git a/layouts/partials/fragments/nav.html b/layouts/partials/fragments/nav.html index 6d5db276..99079a47 100644 --- a/layouts/partials/fragments/nav.html +++ b/layouts/partials/fragments/nav.html @@ -36,7 +36,7 @@ {{- else -}} {{- printf " justify-content-end " -}} {{- end -}} collapse show" id="navbarCollapse"> -