From 7fef003163d1e034a52edc99f20c08c07eed0b9a Mon Sep 17 00:00:00 2001 From: Will Faught Date: Fri, 19 Jul 2024 18:54:16 -0700 Subject: [PATCH] Add default menu --- README.md | 2 +- layouts/partials/paige/site-header.html | 96 ++++++++++++++++--------- 2 files changed, 63 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index aec4fa11..357a0cb0 100644 --- a/README.md +++ b/README.md @@ -346,7 +346,7 @@ link = "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the t ### Menu -An optional menu can be configured. +The menu can be configured using the `main` menu. The active menu item has a URL that is a prefix of the path of the current page. A menu item with the URL `/` only matches a `/` path. diff --git a/layouts/partials/paige/site-header.html b/layouts/partials/paige/site-header.html index e734d79f..57b146dd 100644 --- a/layouts/partials/paige/site-header.html +++ b/layouts/partials/paige/site-header.html @@ -6,7 +6,7 @@ {{ $first := templates.Exists "partials/paige/site-header-first.html" }} {{ $last := templates.Exists "partials/paige/site-header-last.html" }} {{ $links := false }} -{{ $menu := site.Menus.main | and ($page.Param "paige.site.disable_menu" | not) }} +{{ $menu := $page.Param "paige.site.disable_menu" | not }} {{ $pills := false }} {{ $tabs := false }} {{ $title := $page.Param "paige.title" | default site.Title | markdownify | and ($page.Param "paige.site.disable_title" | not) }} @@ -46,44 +46,72 @@
{{ . }}
{{ end }} - {{ with $menu }} - + {{ else }} + {{ $ordered := slice site.Home | append site.Sections }} + + {{ range $name, $taxonomy := site.Taxonomies }} + {{ if and $taxonomy.Page $taxonomy.Page.RelPermalink }} + {{ $ordered = $ordered | append $taxonomy.Page }} {{ end }} - - + {{ end }} + + {{ $ordered = sort $ordered "Title" }} + + + {{ end }} {{ end }} {{ with $breadcrumbs }}