Add language select

This commit is contained in:
Michal Pasierbski 2020-05-24 18:30:37 +02:00
parent 0c40eb4ab7
commit b90922a68f
4 changed files with 24 additions and 0 deletions

View File

@ -16,6 +16,7 @@ googleAnalytics = ""
description = "Anubis is a simple minimalist theme for Hugo blog engine."
[languages.en]
languageName = "English"
[[menu.main]]
identifier = "about"
@ -35,6 +36,9 @@ googleAnalytics = ""
url = "/posts/"
weight = 3
[languages.pl]
languageName = "Polski"
[[languages.pl.menu.main]]
identifier = "about"
name = "O Hugo"

View File

@ -18,6 +18,11 @@
</main>
<footer>
{{ block "footer" . }}
{{ $languagesCount := $.Site.Home.AllTranslations }}
{{ if gt $languagesCount 1 }}
{{ partial "languageSelect.html" . }}
{{ end }}
{{ partial "footer.html" . }}
{{ end }}
</footer>

View File

@ -0,0 +1,5 @@
<ul class="language-select">
{{ range $.Site.Home.AllTranslations }}
<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
{{ end }}
</ul>

View File

@ -349,6 +349,16 @@ footer {
font-size: 16px;
}
ul.language-select {
padding-left: 0;
list-style: none;
display: flex;
}
ul.language-select > li {
margin-right: 1em;
}
/* Media Queries */
@media (max-width: 840px) {