Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Mitrichius/hugo-theme-anubis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Iakunin <yakuninm+github@gmail.com>2021-11-07 15:20:24 +0300
committerMaksim Iakunin <yakuninm+github@gmail.com>2021-11-07 15:20:24 +0300
commit07cd76e7833931e038de2bdc99a24d66cc8d8f96 (patch)
tree8efaeb5cd50398afc4993c19da7c9dd3267c68f9
parent837417e19fd831a6ccd8c873febd63e0f4058ae3 (diff)
Fixing UX-issue with language-switcher
-rw-r--r--layouts/partials/language-switcher.html19
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