hugo-book-theme/layouts/partials/docs/languages.html
2020-02-10 18:39:07 +01:00

29 lines
868 B
HTML

<!-- Merge home and current page translations -->
{{ $langs := dict }}
{{ range .Site.Home.AllTranslations }}
{{ $langs = merge $langs (dict .Language.Lang .) }}
{{ end }}
{{ range .Translations }}
{{ $langs = merge $langs (dict .Language.Lang .) }}
{{ end }}
<div class="book-languages" tabindex="0" aria-haspopup="true">
<ul>
<li class="flex">
<img src="{{ "svg/translate.svg" | relURL }}" class="book-icon" alt="Languages" />
{{ $.Site.Language.LanguageName }}
</li>
</ul>
<ul class="book-languages-list">
{{ range sort $langs }}
<li class="{{ if (eq $.Site.Language .Language) }}active{{ end }}">
<a href="{{ .Permalink }}" class="flex">
<img src="{{ "svg/translate.svg" | relURL }}" class="book-icon" alt="Languages" />
{{ .Language.LanguageName }}
</a>
</li>
{{ end }}
</ul>
</div>