Merge pull request #115 from iakunin/2021-11-07-language-switcher

Fixing UX-issue with language-switcher
This commit is contained in:
Dmitry Kolosov 2021-11-07 18:28:14 +03:00 committed by GitHub
commit c0004087d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,15 @@
<ul class="language-select">
{{ range $.Site.Home.AllTranslations }}
<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
{{ end }}
</ul>
{{ $pageLang := .Page.Lang}}
{{ $translations := .AllTranslations }}
{{ if not .IsTranslated }}
{{ $translations = $.Site.Home.AllTranslations }}
{{ end }}
{{ range $translations }}
{{ if eq .Lang $pageLang }}
<li>{{ .Language.LanguageName }}</li>
{{ else }}
<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
{{ end }}
{{ end }}
</ul>