From 9e5ef02e7a312fd24291f291cfdf9e9633b43119 Mon Sep 17 00:00:00 2001 From: Henk Verlinde Date: Wed, 26 Jan 2022 14:36:47 +0100 Subject: [PATCH] feat: add auto default section menu --- config/_default/params.toml | 4 +- .../partials/sidebar/auto-default-menu.html | 37 ++++++++++++++++++- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index 076c8aa..88514bd 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -90,5 +90,5 @@ lastMod = false [menu] [menu.section] auto = true - collapsibleSidebar = true - mainSections = ["docs", "tutorial"] + collapsibleSidebar = false + mainSections = ["docs"] diff --git a/layouts/partials/sidebar/auto-default-menu.html b/layouts/partials/sidebar/auto-default-menu.html index 19408ec..9a0c9ea 100644 --- a/layouts/partials/sidebar/auto-default-menu.html +++ b/layouts/partials/sidebar/auto-default-menu.html @@ -1 +1,36 @@ - \ No newline at end of file + +{{ $currentPage := . -}} +{{ range (where .Site.Sections "Section" "in" site.Params.menu.section.mainSections) }} + {{ range .Sections.Reverse }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +

{{ .Title }}

+ + {{ end }} +{{ end }} \ No newline at end of file