hugo-book-theme/layouts/partials/docs/languages.html

29 lines
955 B
HTML

<!-- Merge home and current page translations -->
{{ $translations := dict }}
{{ range .Site.Home.AllTranslations }}
{{ $translations = merge $translations (dict .Language.Lang .) }}
{{ end }}
{{ range .Translations }}
{{ $translations = merge $translations (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 .Site.Languages }}{{ with index $translations .Lang }}
<li class="{{ if (eq $.Site.Language .Language) }}active{{ end }}">
<a href="{{ .RelPermalink }}" class="flex">
<img src="{{ "svg/translate.svg" | relURL }}" class="book-icon" alt="Languages" />
{{ .Language.LanguageName }}
</a>
</li>
{{ end }}{{ end }}
</ul>
</div>