Make menus:
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
This commit is contained in:
parent
007d7f3df6
commit
45ed0606ad
@ -1,9 +1,20 @@
|
||||
{{ $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 }}
|
||||
<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
|
||||
{{ 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>
|
||||
|
@ -1,3 +1,4 @@
|
||||
{{ $currentpage := .Page }}
|
||||
<ul class="menu menu--mobile">
|
||||
<li class="menu__trigger">Menu ▾</li>
|
||||
<li>
|
||||
@ -10,10 +11,19 @@
|
||||
{{ if and $.Site.Params.showLanguageSelector (len $.Site.Home.AllTranslations) }}
|
||||
<hr />
|
||||
{{ range $.Site.Home.AllTranslations }}
|
||||
<li>
|
||||
<a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
|
||||
</li>
|
||||
{{ 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>
|
||||
|
Loading…
Reference in New Issue
Block a user