From bb941c3f4fae19f06d0c5ce3dcf64a76c06fef82 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me> Date: Mon, 16 Oct 2023 16:43:45 -0400 Subject: [PATCH] Fixed category side menu not listing tags --- layouts/partials/categories_menu.html | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/layouts/partials/categories_menu.html b/layouts/partials/categories_menu.html index 4b2770d18..538b91830 100644 --- a/layouts/partials/categories_menu.html +++ b/layouts/partials/categories_menu.html @@ -6,19 +6,18 @@ <!-- {{ $taxonomy := .Data.Plural }} --> {{ $taxonomy := "tags" }} {{/* Get sections where one or more pages has one or more terms in the current taxonomy. */}} - {{ $sections := slice }} + {{ $terms := slice }} {{ range $term, $weightedPages := index site.Taxonomies $taxonomy }} - {{ range $weightedPages }} - {{ $sections = $sections | append .CurrentSection | uniq | sort }} + {{ range $weightedPage := $weightedPages }} + {{ if (eq $hereSection $weightedPage.Section) }} + {{ $terms = $terms | append $term | uniq }} + {{ end }} {{ end }} {{ end }} + {{/* List pages by term by section. */}} - {{ range $section := (where $sections ".Path" $hereSection) }} - {{ range $term, $weightedPages := index site.Taxonomies $taxonomy }} - {{ $termPage := site.GetPage path.Join $taxonomy $term }} - {{ with where $weightedPages "Section" $section.Path }} - <a href="{{ $termPage.RelPermalink }}" class='menu-item' data-slug='{{ $termPage.LinkTitle }}' title="All pages with tag <i>{{ $termPage.LinkTitle }}</i>">{{ $termPage.LinkTitle }}</a> - {{ end }} - {{ end }} + {{ range $term := $terms }} + {{ $termPage := site.GetPage path.Join $taxonomy $term }} + <a href="{{ $termPage.RelPermalink }}" class='menu-item' data-slug='{{ $termPage.LinkTitle }}' title="All pages with tag <i>{{ $termPage.LinkTitle }}</i>">{{ $termPage.LinkTitle }}</a> {{ end }} </nav> -- GitLab