45ed0606ad
1. Not repeat the current page language 2. point to the same page in the other languages rather than to the web site's root
22 lines
883 B
HTML
22 lines
883 B
HTML
{{ $currentpage := .Page }}
|
|
<ul class="menu menu--desktop menu--language-selector">
|
|
<li class="menu__trigger">{{ .Language.LanguageName }} ▾</li>
|
|
<li>
|
|
<ul class="menu__dropdown">
|
|
{{ range $.Site.Home.AllTranslations }}
|
|
{{ if ne .Lang $currentpage.Language.Lang }}
|
|
{{ if eq .Lang $.Site.Params.DefaultContentLanguage }}
|
|
<li><a href="{{ strings.Substr $currentpage.RelPermalink 3 }}">{{ .Language.LanguageName }}</a></li>
|
|
{{ else }}
|
|
{{ if eq $currentpage.Language.Lang $.Site.Params.DefaultContentLanguage }}
|
|
<li><a href="/{{ .Lang }}{{ $currentpage.RelPermalink }}">{{ .Language.LanguageName }}</a></li>
|
|
{{ else }}
|
|
<li><a href="/{{ .Lang }}{{ substr $currentpage.RelPermalink 3 }}">{{ .Language.LanguageName }}</a></li>
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
</ul>
|
|
</li>
|
|
</ul>
|