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
31 lines
1.1 KiB
HTML
31 lines
1.1 KiB
HTML
{{ $currentpage := .Page }}
|
|
<ul class="menu menu--mobile">
|
|
<li class="menu__trigger">Menu ▾</li>
|
|
<li>
|
|
<ul class="menu__dropdown">
|
|
{{ range $.Site.Menus.main }}
|
|
{{ if not .HasChildren }}
|
|
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ if and $.Site.Params.showLanguageSelector (len $.Site.Home.AllTranslations) }}
|
|
<hr />
|
|
{{ 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 }}
|
|
|
|
{{ end }}
|
|
</ul>
|
|
</li>
|
|
</ul>
|