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

@ -41,30 +41,38 @@
text-decoration: none; text-decoration: none;
} }
} }
}
.site-header__nav {
font-size: var(--text-m);
font-weight: normal;
ul { .site-nav {
--spacing: 1ch; font-size: var(--text-m);
font-weight: normal;
display: flex; ul {
gap: var(--spacing); --spacing: 2ch;
list-style: none;
display: flex;
gap: var(--spacing);
list-style: none;
margin: 0;
padding: 0;
.site-nav__item {
margin: 0; margin: 0;
padding: 0; padding: 0;
}
li { .site-nav__item::after {
margin: 0; color: var(--color-nav-separator);
padding: 0; justify-content: center;
} }
li::after { :is(.site-nav__item, .site-nav__item--dir)::after {
color: var(--color-nav-separator); content: "/";
content: "/"; }
justify-content: center;
} .site-nav__item--file::after {
content: "*";
} }
} }
} }

View file

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