Allow the menu to specify a style for the item

Style changes the trailing character, a la ls -F. The default is 'dir', appending
a slash `/`. You can also specify 'file' to append a '*'.
This commit is contained in:
Eryn Wells 2024-10-20 09:18:34 -07:00
parent 60db7eeb03
commit 50dc3c45c1
2 changed files with 33 additions and 19 deletions

View file

@ -11,7 +11,7 @@ Renders a menu for the given menu ID.
{{- $menuID := .menuID }}
{{- with index site.Menus $menuID }}
<nav class="site-header__nav">
<nav class="site-nav">
<ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
</ul>
@ -33,7 +33,13 @@ Renders a menu for the given menu ID.
{{- $name = . }}
{{- end }}
{{- end }}
<li>{{- "" -}}
<li
{{- with .Params.style }}
class="site-nav__item site-nav__item--{{ . }}"
{{ else }}
class="site-nav__item site-nav__item--dir"
{{ end -}}
>{{- "" -}}
<a
{{- range $k, $v := $attrs }}
{{- with $v }}