From f8f5a956615833ef0932941663ced98c588a3c77 Mon Sep 17 00:00:00 2001 From: raspopov Date: Thu, 6 May 2021 20:38:46 +0300 Subject: [PATCH] Improved sections menu and added a new site parameters: BookCollapseSection (was front matter only, global now) and BookCollapseSectionLevel (used for auto-expand up to specified nest level). Signed-off-by: raspopov --- layouts/partials/docs/menu-filetree.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/layouts/partials/docs/menu-filetree.html b/layouts/partials/docs/menu-filetree.html index a4835b2..9ad1287 100644 --- a/layouts/partials/docs/menu-filetree.html +++ b/layouts/partials/docs/menu-filetree.html @@ -4,32 +4,32 @@ {{ end }} {{ with .Site.GetPage $bookSection }} - {{ template "book-section-children" (dict "Section" . "CurrentPage" $) }} + {{ template "book-section-children" (dict "Section" . "CurrentPage" $ "Level" 1) }} {{ end }} -{{ define "book-section-children" }}{{/* (dict "Section" .Section "CurrentPage" .CurrentPage) */}} +{{ define "book-section-children" }}{{/* (dict "Section" .Section "CurrentPage" .CurrentPage "Level" .Level) */}} {{ end }} -{{ define "book-page-link" }}{{/* (dict "Page" .Page "CurrentPage" .CurrentPage) */}} +{{ define "book-page-link" }}{{/* (dict "Page" .Page "CurrentPage" .CurrentPage "Level" .Level) */}} {{ $current := eq .CurrentPage .Page }} {{ $ancestor := .Page.IsAncestor .CurrentPage }} - {{ if .Page.Params.bookCollapseSection }} - + {{ if (and .Page.IsSection (default .Page.Site.Params.BookCollapseSection .Page.Params.BookCollapseSection)) }} +