mirror of
https://github.com/imfing/hextra.git
synced 2025-07-12 21:21:36 -04:00
fix: generate mobile nav data
This commit is contained in:
17
layouts/partials/utils/translated-page.html
Normal file
17
layouts/partials/utils/translated-page.html
Normal 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 -}}
|
Reference in New Issue
Block a user