Hide lang switch separator if not multilang

This commit is contained in:
Dawid Wróbel 2024-04-25 17:56:36 +02:00
parent 5e61be5903
commit 5dc09b99d8

View File

@ -72,24 +72,26 @@
{{- $lang := .Lang}} {{- $lang := .Lang}}
{{- $separator := or $label_text (not site.Params.disableThemeToggle)}} {{- $separator := or $label_text (not site.Params.disableThemeToggle)}}
{{- with site.Home.AllTranslations }} {{- if gt (len site.Home.AllTranslations) 1 }}
<ul class="lang-switch"> {{ with site.Home.AllTranslations }}
{{- if $separator }}<li>|</li>{{ end }} <ul class="lang-switch">
{{- range . -}} {{- if $separator }}<li>|</li>{{ end }}
{{- if ne $lang .Lang }} {{- range . -}}
<li> {{- if ne $lang .Lang }}
<a href="{{- .Permalink -}}" title="{{ .Language.Params.languageAltTitle | default (.Language.LanguageName | emojify) | default (.Lang | title) }}" <li>
aria-label="{{ .Language.LanguageName | default (.Lang | title) }}"> <a href="{{- .Permalink -}}" title="{{ .Language.Params.languageAltTitle | default (.Language.LanguageName | emojify) | default (.Lang | title) }}"
{{- if (and site.Params.displayFullLangName (.Language.LanguageName)) }} aria-label="{{ .Language.LanguageName | default (.Lang | title) }}">
{{- .Language.LanguageName | emojify -}} {{- if (and site.Params.displayFullLangName (.Language.LanguageName)) }}
{{- else }} {{- .Language.LanguageName | emojify -}}
{{- .Lang | title -}} {{- else }}
{{- end -}} {{- .Lang | title -}}
</a> {{- end -}}
</li> </a>
{{- end -}} </li>
{{- end}} {{- end -}}
</ul> {{- end}}
</ul>
{{- end }}
{{- end }} {{- end }}
</div> </div>
</div> </div>