fix: generate mobile nav data

This commit is contained in:
Xin
2024-12-30 22:38:28 +00:00
parent b01c8ee405
commit f8e02e6151
3 changed files with 53 additions and 7 deletions

View File

@ -0,0 +1,17 @@
{{/*
Utility to retrieve a translated page given a page and a language code.
If the page is not translated, it returns the original page.
*/}}
{{- $page := .page -}}
{{- $lang := .lang -}}
{{- if $page.IsTranslated -}}
{{- range $page.AllTranslations -}}
{{- if eq .Language.LanguageCode $lang -}}
{{- $page = . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- return $page -}}