diff options
author | Alex Shpak <alex-shpak@users.noreply.github.com> | 2020-04-14 22:56:31 +0200 |
---|---|---|
committer | Alex Shpak <alex-shpak@users.noreply.github.com> | 2020-04-14 22:56:31 +0200 |
commit | 94c8230e1e15a2170a3cb9c38a2f0da95a3e50ea (patch) | |
tree | 71fe3838f45a4799abca8ed7edb5e469f5a24540 | |
parent | 9719692512325b5f88de666281ba286343408010 (diff) |
#197, Use RelPermalink to identify nested pages in collapsed menu
-rw-r--r-- | layouts/partials/docs/menu-filetree.html | 7 |
1 files 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) }} <ul> {{ range (where .Section.Pages "Params.bookhidden" "ne" true) }} {{ if .IsSection }} @@ -33,7 +34,7 @@ {{ if .Page.Content }} <a href="{{ .Page.RelPermalink }}" class=" {{- if and .Page.Params.bookCollapseSection .Page.IsSection }}collapsed {{ end }} - {{- if eq .CurrentPage.RelPermalink .Page.RelPermalink }}active{{ end }}"> + {{- if eq .CurrentPage .Page }}active{{ end }}"> {{- partial "docs/title" .Page -}} </a> {{ else }} |