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;
}
}
}
.site-header__nav {
font-size: var(--text-m);
font-weight: normal;
ul {
--spacing: 1ch;
.site-nav {
font-size: var(--text-m);
font-weight: normal;
display: flex;
gap: var(--spacing);
list-style: none;
ul {
--spacing: 2ch;
display: flex;
gap: var(--spacing);
list-style: none;
margin: 0;
padding: 0;
.site-nav__item {
margin: 0;
padding: 0;
}
li {
margin: 0;
padding: 0;
}
.site-nav__item::after {
color: var(--color-nav-separator);
justify-content: center;
}
li::after {
color: var(--color-nav-separator);
content: "/";
justify-content: center;
}
:is(.site-nav__item, .site-nav__item--dir)::after {
content: "/";
}
.site-nav__item--file::after {
content: "*";
}
}
}

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 }}