Skip to content

Commit a3da316

Browse files
authored
fix language menu (#166) (#169)
1 parent 0f06c79 commit a3da316

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

page/layouts/partials/menu.html

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,13 @@ <h3>{{ if not $disableShortcutsTitle}}{{ T "Shortcuts-Title"}}{{ end }}</h3>
4848
<i class="fas fa-language fa-fw"></i>
4949
<div class="select-style">
5050
<select id="select-language" onchange="location = this.value;">
51-
{{ $siteLanguages := .Site.Languages}}
52-
{{ $baseUrl := .Site.BaseURL}}
53-
{{ $pageLang := .Page.Lang}}
54-
{{ range .Page.AllTranslations }}
55-
{{ $translation := .}}
56-
{{ range $siteLanguages }}
57-
{{ if eq $translation.Lang .Lang }}
58-
{{ $selected := false }}
59-
{{ if eq $pageLang .Lang}}
60-
<option id="{{ $translation.Language }}" value="{{ $baseUrl }}{{ $translation.URL }}" selected>{{ .LanguageName }}</option>
61-
{{ else }}
62-
<option id="{{ $translation.Language }}" value="{{ $baseUrl }}{{ $translation.URL }}">{{ .LanguageName }}</option>
63-
{{ end }}
64-
{{ end }}
51+
{{ range .AllTranslations }}
52+
{{ if eq .Page.Lang .Lang }}
53+
<option id="{{ .Language }}" value="{{ .Permalink }}" selected>{{ .Language.LanguageName }}</option>
54+
{{ else }}
55+
<option id="{{ .Language }}" value="{{ .Permalink }}">{{ .Language.LanguageName }}</option>
56+
{{ end }}
6557
{{ end }}
66-
{{ end }}
6758
</select>
6859
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
6960
width="255px" height="255px" viewBox="0 0 255 255" style="enable-background:new 0 0 255 255;" xml:space="preserve">

0 commit comments

Comments
 (0)