This commit is contained in:
Mirai Kumiko 2025-02-04 20:12:29 +00:00
parent 224768e9fa
commit 4cf318b5ad
4 changed files with 23 additions and 33 deletions

23
layouts/partials/nav.html Normal file
View file

@ -0,0 +1,23 @@
{{ range .Site.Menus.main.ByWeight }}
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
<a href='https://contacts.miraikumiko.com'>Contacts</a>
<a href='{{ absURL "index.xml" }}'>RSS</a>
<!-- Convert this page's translations into a dict -->
{{ $translations := dict }}
{{ range .Translations }}
{{ $translations = merge $translations (dict .Language.Lang .) }}
{{ end }}
<!-- Create a link to every translation -->
{{ range where .Site.Languages "Lang" "!=" .Page.Lang }}
{{ with (index $translations .Lang) }}
<a href="{{ .RelPermalink }}">{{ .Language.LanguageName }}</a>
{{ else }}
<!-- The complicated setup was necessary to make a grayed out link -->
{{ if not .Params.hideUntranslated }}
<a class="disabled" role="link" aria-disabled="true">{{ .LanguageName }}</a>
{{ end }}
{{ end }}
{{ end }}