feat: add multilingual mode support (#241)

BREAKING CHANGE:  Layout file renamed ´layouts/partials/page-footer.html → layouts/partials/menu-nextprev.html`. If you use overrides, you might need to change the filenames as well.
This commit is contained in:
Robert Kaussow 2022-01-23 13:21:44 +01:00 committed by GitHub
parent 42ebf067bb
commit 5c22ce57dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
88 changed files with 437 additions and 144 deletions

View file

@ -15,8 +15,15 @@
{{ $isCurrent := eq $current $this }}
{{ $icon := default false .icon }}
{{ if reflect.IsMap .name }}
{{ $current.Scratch.Set "refName" (index .name $site.Language.Lang) }}
{{ else }}
{{ $current.Scratch.Set "refName" .name }}
{{ end }}
{{ $name := $current.Scratch.Get "refName" }}
{{ if not .icon }}
{{ errorf "Missing 'icon' attribute in data file for '%s' menu item '%s'" $target .name }}
{{ errorf "Missing 'icon' attribute in data file for '%s' menu item '%s'" $target $name }}
{{ end }}
{{ if eq $target "header" }}
@ -30,7 +37,7 @@
class="gdoc-header__link"
>
<svg class="icon {{ .icon }}">
<title>{{ .name }}</title>
<title>{{ $name }}</title>
<use xlink:href="#{{ .icon }}"></use>
</svg>
</a>