create/skeletons: Fix menu template

Check identifier existence before calling lang.Translate to prevent
empty warnings when using the --printI18nWarnings flag.

Closes #11519
This commit is contained in:
Joe Mooring 2023-10-03 19:36:14 -07:00 committed by Bjørn Erik Pedersen
parent 27b22cd87e
commit acf01bfb78

View file

@ -27,6 +27,12 @@ Renders a menu for the given menu ID.
{{- else if $page.HasMenuCurrent .Menu .}} {{- else if $page.HasMenuCurrent .Menu .}}
{{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }} {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }}
{{- end }} {{- end }}
{{- $name := .Name }}
{{- with .Identifier }}
{{- with T . }}
{{- $name = . }}
{{- end }}
{{- end }}
<li> <li>
<a <a
{{- range $k, $v := $attrs }} {{- range $k, $v := $attrs }}
@ -34,7 +40,7 @@ Renders a menu for the given menu ID.
{{- printf " %s=%q" $k $v | safeHTMLAttr }} {{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }} {{- end }}
{{- end -}} {{- end -}}
>{{ or (T .Identifier) .Name | safeHTML }}</a> >{{ $name }}</a>
{{- with .Children }} {{- with .Children }}
<ul> <ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }} {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}