modified navigation language list

This commit is contained in:
somrat 2019-08-22 12:39:33 +06:00
parent ae7355b997
commit 461da81c88

View file

@ -31,10 +31,23 @@
{{ end }} {{ end }}
</ul> </ul>
<!-- Language List --> <!-- Language List -->
<ul class="list-inline text-center mb-0"> <select id="select-language" onchange="location = this.value;">
{{ range $.Site.Home.AllTranslations }} {{ $siteLanguages := .Site.Languages}}
<li class="list-inline-item"><a class="text-dark" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li> {{ $pageLang := .Page.Lang}}
{{ range .Page.AllTranslations }}
{{ $translation := .}}
{{ range $siteLanguages }}
{{ if eq $translation.Lang .Lang }}
{{ $selected := false }}
{{ if eq $pageLang .Lang}}
<option id="{{ $translation.Language }}" value="{{ $translation.URL }}" selected>{{ .LanguageName }}
</option>
{{ else }}
<option id="{{ $translation.Language }}" value="{{ $translation.URL }}">{{ .LanguageName }}</option>
{{ end }} {{ end }}
</ul> {{ end }}
{{ end }}
{{ end }}
</select>
</div> </div>
</nav> </nav>