From f0edb03105ffc7a18f6a3b4dda58f311a3a2c0d3 Mon Sep 17 00:00:00 2001 From: Henk Verlinde Date: Thu, 20 Jan 2022 15:37:15 +0100 Subject: [PATCH] feat: add auto collapsibile multi level section menu --- config/_default/params.toml | 11 ++++- layouts/partials/sidebar/docs-menu.html | 66 ++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 3 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index dcbc7bd..d1708ca 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -74,6 +74,10 @@ docsRepoBranch = "master" editPage = false lastMod = false + +mainSections = ["docs"] + + [options] lazySizes = true clipBoard = true @@ -84,6 +88,11 @@ lastMod = false breadCrumb = true highLight = true kaTex = false - collapsibleSidebar = true multilingualMode = false docsVersioning = false + +[menu] + + [menu.section] + auto = false + collapsibleSidebar = false diff --git a/layouts/partials/sidebar/docs-menu.html b/layouts/partials/sidebar/docs-menu.html index 316de10..2d73be4 100644 --- a/layouts/partials/sidebar/docs-menu.html +++ b/layouts/partials/sidebar/docs-menu.html @@ -1,4 +1,65 @@ -{{ if .Site.Params.options.collapsibleSidebar -}} +{{ if and .Site.Params.menu.section.auto .Site.Params.menu.section.collapsibleSidebar -}} + + +{{ else if and .Site.Params.menu.section.auto (not .Site.Params.menu.section.collapsibleSidebar) -}} + + +{{ else if and (not .Site.Params.menu.section.auto) .Site.Params.menu.section.collapsibleSidebar -}} + -{{ else -}} +{{ else if and (not .Site.Params.menu.section.auto) (not .Site.Params.menu.section.collapsibleSidebar) -}} + {{ $currentPage := . -}} {{ range .Site.Menus.docs -}}

{{ .Name }}