Merge pull request #21663 from dvdksn/fix-sidebar-reverse

hugo: fix 'reverse' option for re-ordering sidebar entries
This commit is contained in:
David Karlsson 2024-12-18 14:42:01 +01:00 committed by GitHub
commit 6a97d65750
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -42,6 +42,7 @@
"Docker-Desktop",
"Docker-Hub",
"Docker-Scout-Dashboard",
"Docker-plan",
"Download",
"Entra-ID",
"Entra-ID-SAML-2.0",
@ -68,6 +69,8 @@
"JavaScript",
"Jenkins",
"Latest",
"Legacy-Docker-plan",
"Legacy-Docker-plans",
"Linux",
"Local-or-Hub-storage",
"MDM",
@ -138,7 +141,6 @@
"aspect-video",
"bake-action",
"bg-amber-light",
"bg-amber-light-200",
"bg-background-light",
"bg-black/50",
"bg-black/70",
@ -191,7 +193,6 @@
"containerd-image-store",
"cursor-pointer",
"dark:bg-amber-dark",
"dark:bg-amber-dark-200",
"dark:bg-background-dark",
"dark:bg-blue-dark",
"dark:bg-blue-dark-400",
@ -261,6 +262,7 @@
"flex-col",
"flex-col-reverse",
"flex-grow",
"flex-grow-0",
"flex-none",
"flex-shrink",
"flex-wrap",
@ -342,6 +344,7 @@
"lg:gap-8",
"lg:grid-cols-2",
"lg:grid-cols-3",
"lg:grid-cols-4",
"lg:hidden",
"lg:no-underline",
"lg:pb-2",

View File

@ -8,11 +8,10 @@
</nav>
{{ define "renderChildren" }}
{{- $pages := .Pages }}
{{- $pages := where .Pages "Params.sitemap" "ne" "false" }}
{{- if .Params.sidebar.reverse }}
{{ $pages = .Pages.Reverse }}
{{- end }}
{{- $pages = where .Pages "Params.sitemap" "ne" "false" }}
{{- $ungrouped := where $pages "Params.sidebar.group" "==" nil }}
{{- range $ungrouped }}
{{- if .IsSection }}