Skip to content

Commit

Permalink
create/skeletons: Fix menu template
Browse files Browse the repository at this point in the history
Check identifier existence before calling lang.Translate to prevent
empty warnings when using the --printI18nWarnings flag.

Closes #11519
  • Loading branch information
jmooring authored and bep committed Oct 30, 2023
1 parent 27b22cd commit acf01bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion create/skeletons/theme/layouts/partials/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,20 @@
{{- 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 }}
{{- with $v }}
{{- 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" .) }}
Expand Down

0 comments on commit acf01bf

Please sign in to comment.