aboutsummaryrefslogtreecommitdiffhomepage
path: root/create
diff options
context:
space:
mode:
authorJoe Mooring <[email protected]>2023-10-03 19:36:14 -0700
committerBjørn Erik Pedersen <[email protected]>2023-10-30 09:02:49 +0100
commitacf01bfb7842c52aab4af8fe599b6b3662b7b3e6 (patch)
treef630aec279f78d9069b2da51a20fa0415d720bbc /create
parent27b22cd87e0637da9714e4161e33b8e7f5c5bc46 (diff)
downloadhugo-acf01bfb7842c52aab4af8fe599b6b3662b7b3e6.tar.gz
hugo-acf01bfb7842c52aab4af8fe599b6b3662b7b3e6.zip
create/skeletons: Fix menu template
Check identifier existence before calling lang.Translate to prevent empty warnings when using the --printI18nWarnings flag. Closes #11519
Diffstat (limited to 'create')
-rw-r--r--create/skeletons/theme/layouts/partials/menu.html8
1 files changed, 7 insertions, 1 deletions
diff --git a/create/skeletons/theme/layouts/partials/menu.html b/create/skeletons/theme/layouts/partials/menu.html
index 8f72130d0..718318096 100644
--- a/create/skeletons/theme/layouts/partials/menu.html
+++ b/create/skeletons/theme/layouts/partials/menu.html
@@ -27,6 +27,12 @@ Renders a menu for the given menu ID.
{{- else if $page.HasMenuCurrent .Menu .}}
{{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }}
{{- end }}
+ {{- $name := .Name }}
+ {{- with .Identifier }}
+ {{- with T . }}
+ {{- $name = . }}
+ {{- end }}
+ {{- end }}
<li>
<a
{{- range $k, $v := $attrs }}
@@ -34,7 +40,7 @@ Renders a menu for the given menu ID.
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }}
{{- end -}}
- >{{ or (T .Identifier) .Name | safeHTML }}</a>
+ >{{ $name }}</a>
{{- with .Children }}
<ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}