From 94c8230e1e15a2170a3cb9c38a2f0da95a3e50ea Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Tue, 14 Apr 2020 22:56:31 +0200 Subject: [PATCH] #197, Use RelPermalink to identify nested pages in collapsed menu --- layouts/partials/docs/menu-filetree.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/layouts/partials/docs/menu-filetree.html b/layouts/partials/docs/menu-filetree.html index 489a62f..4233a07 100644 --- a/layouts/partials/docs/menu-filetree.html +++ b/layouts/partials/docs/menu-filetree.html @@ -8,10 +8,11 @@ {{ end }} {{ define "book-section-children" }}{{/* (dict "Section" .Section "CurrentPage" .CurrentPage) */}} - {{ $ancestor := .Section.IsAncestor .CurrentPage }} + {{ $self := eq .CurrentPage .Section }} + {{ $ancestor := strings.HasPrefix .CurrentPage.RelPermalink .Section.RelPermalink }} {{ $collapsed := .Section.Params.bookCollapseSection }} - {{ if or $ancestor (not $collapsed) }} + {{ if or $self $ancestor (not $collapsed) }}