mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -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 .}}
|
||||
{{- $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" .) }}
|
||||
|
|
Loading…
Reference in a new issue