feat: Hugo engine for iGaming affiliate template (layouts, assets, i18n, verified data, CI build script)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
{{- /* language-switcher.html — content LANGUAGE switcher (distinct from the region
|
||||
switcher). The region switcher (locale-switcher.html) changes compliance
|
||||
chrome (age/RG/currency) client-side; THIS switcher navigates to the
|
||||
translated page of the SAME content (linked via front-matter translationKey).
|
||||
Renders nothing on single-language builds. */ -}}
|
||||
{{- if gt (len site.Languages) 1 -}}
|
||||
<div class="relative">
|
||||
<label for="language-switcher" class="sr-only">{{ i18n "selectLanguage" | default "Language" }}</label>
|
||||
<select id="language-switcher" data-language-switcher
|
||||
onchange="if(this.value){window.location.href=this.value;}"
|
||||
class="rounded-md border border-secondary/20 bg-white py-1.5 pl-2 pr-7 text-sm text-secondary focus-visible:outline-primary">
|
||||
{{- $cur := . -}}
|
||||
{{- range site.Languages -}}
|
||||
{{- $lang := . -}}
|
||||
{{- $isCurrent := eq $lang.Lang $cur.Language.Lang -}}
|
||||
{{- $href := "" -}}
|
||||
{{- /* Prefer the direct translation of the current page… */ -}}
|
||||
{{- range $cur.AllTranslations -}}
|
||||
{{- if eq .Language.Lang $lang.Lang -}}{{- $href = .RelPermalink -}}{{- end -}}
|
||||
{{- end -}}
|
||||
{{- /* …otherwise fall back to that language's home page. */ -}}
|
||||
{{- if not $href -}}
|
||||
{{- with site.Home.AllTranslations -}}
|
||||
{{- range . -}}{{- if eq .Language.Lang $lang.Lang -}}{{- $href = .RelPermalink -}}{{- end -}}{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if not $href -}}{{- $href = "/" -}}{{- end -}}
|
||||
<option value="{{ $href }}"{{ if $isCurrent }} selected{{ end }}>{{ $lang.LanguageName | default (upper $lang.Lang) }}</option>
|
||||
{{- end -}}
|
||||
</select>
|
||||
</div>
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user