aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/docs/languages.html
diff options
context:
space:
mode:
authorAlex Shpak <alex-shpak@users.noreply.github.com>2019-11-10 00:23:06 +0100
committerAlex Shpak <alex-shpak@users.noreply.github.com>2019-11-16 20:35:23 +0100
commit05c3b8fac9bec7cf54fed20d93fac52e1e97ad97 (patch)
tree616345b1ec544000d9b3471852ac088bc8df382c /layouts/partials/docs/languages.html
parent9cd378a2d27ad4c9cb2e46d12022e68e23f96ea7 (diff)
Add language switch at bottom of page
Diffstat (limited to 'layouts/partials/docs/languages.html')
-rw-r--r--layouts/partials/docs/languages.html32
1 files changed, 32 insertions, 0 deletions
diff --git a/layouts/partials/docs/languages.html b/layouts/partials/docs/languages.html
new file mode 100644
index 0000000..d905327
--- /dev/null
+++ b/layouts/partials/docs/languages.html
@@ -0,0 +1,32 @@
+{{ if .Site.IsMultiLingual }}
+<!-- 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">
+
+ <ul>
+ <li class="flex">
+ <img src="{{ "svg/translate.svg" | relURL }}" />
+ {{ $.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 }}" />
+ {{ .Language.LanguageName }}
+ </a>
+ </li>
+ {{ end }}
+ </ul>
+
+</div>
+{{ end }}