aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/docs/menu-filetree.html16
1 files changed, 11 insertions, 5 deletions
diff --git a/layouts/partials/docs/menu-filetree.html b/layouts/partials/docs/menu-filetree.html
index c8dd86b..c917828 100644
--- a/layouts/partials/docs/menu-filetree.html
+++ b/layouts/partials/docs/menu-filetree.html
@@ -11,19 +11,19 @@
{{/* If there is only one section to render then render its children, else render all sections */}}
{{ if eq (len $sections) 1 }}
{{ with index $sections 0 }}
- {{ template "book-section-children" (dict "Section" . "CurrentPage" $.Permalink) }}
+ {{ template "book-section-children" (dict "Section" . "CurrentPage" $) }}
{{ end }}
{{ else }}
<ul>
{{ range where $sections "Params.bookhidden" "!=" true }}
- {{ template "book-section" (dict "Section" . "CurrentPage" $.Permalink) }}
+ {{ template "book-section" (dict "Section" . "CurrentPage" $) }}
{{ end }}
</ul>
{{ end }}
{{ define "book-section" }}
{{ with .Section }}
- <li {{ if .Params.BookFlatSection}} class="book-section-flat" {{ end }}>
+ <li {{ if .Params.BookFlatSection }} class="book-section-flat" {{ end }}>
{{ if .Content }}
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
{{ else }}
@@ -36,7 +36,11 @@
{{ end }}
{{ define "book-section-children" }}
-{{ with .Section }}
+{{ $ancestor := .Section.IsAncestor .CurrentPage }}
+{{ $collapsed := .Section.Params.bookCollapseSection }}
+
+{{ if or $ancestor (not $collapsed) }}
+ {{ with .Section }}
<ul>
{{ range where .Pages "Params.bookhidden" "!=" "true" }}
{{ if eq .Kind "section" }}
@@ -48,12 +52,14 @@
{{ end }}
{{ end }}
</ul>
+ {{ end }}
{{ end }}
+
{{ end }}
{{ define "book-page-link" }}
{{ with .Page }}
- <a href="{{ .RelPermalink }}" {{ if eq $.CurrentPage .Permalink }} class="active"{{ end }}>
+ <a href="{{ .RelPermalink }}" {{ if eq $.CurrentPage . }} class="active"{{ end }}>
{{ partial "docs/title" . }}
</a>
{{ end }}