diff options
author | Maksim Iakunin <yakuninm+github@gmail.com> | 2021-11-07 15:20:24 +0300 |
---|---|---|
committer | Maksim Iakunin <yakuninm+github@gmail.com> | 2021-11-07 15:20:24 +0300 |
commit | 07cd76e7833931e038de2bdc99a24d66cc8d8f96 (patch) | |
tree | 8efaeb5cd50398afc4993c19da7c9dd3267c68f9 | |
parent | 837417e19fd831a6ccd8c873febd63e0f4058ae3 (diff) |
Fixing UX-issue with language-switcher
-rw-r--r-- | layouts/partials/language-switcher.html | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/layouts/partials/language-switcher.html b/layouts/partials/language-switcher.html index 7e2e848..5783de3 100644 --- a/layouts/partials/language-switcher.html +++ b/layouts/partials/language-switcher.html @@ -1,5 +1,16 @@ -<ul class="language-select"> -{{ range $.Site.Home.AllTranslations }} -<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li> +{{ if .IsTranslated }} + {{ $pageLang := .Page.Lang}} + <ul class="language-select"> + {{ range .AllTranslations }} + {{ if eq .Lang $pageLang }} + <li> + {{ .Language.LanguageName }} + </li> + {{ else }} + <li> + <a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a> + </li> + {{ end }} + {{ end }} + </ul> {{ end }} -</ul>
\ No newline at end of file |