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

34 lines
1.0 KiB
HTML
Raw Normal View History

2019-11-09 23:23:06 +00:00
<!-- Merge home and current page translations -->
{{ $bookTranslatedOnly := default false .Site.Params.BookTranslatedOnly }}
{{ $translations := dict }}
{{ if (eq $bookTranslatedOnly false ) }}
{{ range .Site.Home.Translations }}
{{ $translations = merge $translations (dict .Language.Lang .) }}
{{ end }}
2019-11-09 23:23:06 +00:00
{{ end }}
{{ range .Translations }}
{{ $translations = merge $translations (dict .Language.Lang .) }}
2019-11-09 23:23:06 +00:00
{{ end }}
<ul class="book-languages">
<li>
<input type="checkbox" id="languages" class="toggle" />
<label for="languages" class="flex justify-between">
<a role="button" class="flex align-center">
2019-12-09 10:05:49 +00:00
<img src="{{ "svg/translate.svg" | relURL }}" class="book-icon" alt="Languages" />
{{ $.Site.Language.LanguageName }}
2019-11-09 23:23:06 +00:00
</a>
</label>
<ul>
{{ range .Site.Languages }}{{ with index $translations .Lang }}
<li>
<a href="{{ .Permalink }}">
{{ .Language.LanguageName }}
</a>
</li>
{{ end }}{{ end }}
</ul>
</li>
</ul>