From 87e1983a5248366e7b778f60f45c4d6997151a42 Mon Sep 17 00:00:00 2001 From: Hugo Trentesaux <hugo@trentesaux.fr> Date: Wed, 19 Oct 2022 19:59:23 +0200 Subject: [PATCH] [theme] automate langage menu from config file variables --- config.toml | 1 + templates/nav.html | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config.toml b/config.toml index 5f857c1..7397c16 100644 --- a/config.toml +++ b/config.toml @@ -16,6 +16,7 @@ highlight_code = true highlight_theme = "base16-ocean-light" [extra] +flag = "🇫🇷" [extra.translations.en] base_url = "http://duniter.trentesaux.fr/" diff --git a/templates/nav.html b/templates/nav.html index e87dead..8db01ad 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -16,9 +16,11 @@ {# --- langage dropdown --- -#} <div class="w3-dropdown-hover w3-dropdown-click w3-right"> - <button class="w3-button" style="font-size: 1.6em; padding: 0 10px;">🇫🇷</button> + <button class="w3-button" style="font-size: 1.6em; padding: 0 10px;">{{config.extra.flag}}</button> <div class="w3-dropdown-content w3-bar-block w3-light-grey" style="min-width: 29px;"> - <a href="https://duniter.org/" title="English website" style="font-size: 1.6em; padding: 0 10px;">🇬🇧</a> + {%- for ltag,lcfg in config.extra.translations %} + <a href="{{lcfg.base_url}}" title="{{ltag}} website" style="font-size: 1.6em; padding: 0 10px;">{{lcfg.flag}}</a> + {%- endfor %} </div> </div> -- GitLab