mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
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:
parent
27b22cd87e
commit
acf01bfb78
1 changed files with 7 additions and 1 deletions
|
@ -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" .) }}
|
||||||
|
|
Loading…
Reference in a new issue