aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/docs/menu-filetree.html
diff options
context:
space:
mode:
authorAlex Shpak <alex-shpak@users.noreply.github.com>2020-04-14 22:56:31 +0200
committerAlex Shpak <alex-shpak@users.noreply.github.com>2020-04-14 22:56:31 +0200
commit94c8230e1e15a2170a3cb9c38a2f0da95a3e50ea (patch)
tree71fe3838f45a4799abca8ed7edb5e469f5a24540 /layouts/partials/docs/menu-filetree.html
parent9719692512325b5f88de666281ba286343408010 (diff)
#197, Use RelPermalink to identify nested pages in collapsed menu
Diffstat (limited to 'layouts/partials/docs/menu-filetree.html')
-rw-r--r--layouts/partials/docs/menu-filetree.html7
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 }}