Fixes #69 Make file based menus behave as expected

- Fixes #69
- Section headings are listed once
- Sections and normal pages sort with the same weights amongst themselves
This commit is contained in:
Paul Twohey
2019-08-28 21:53:19 -07:00
committed by Alex Shpak
parent 64dfdf39fb
commit 7d0ee68c3b
2 changed files with 9 additions and 8 deletions
+8 -7
View File
@@ -38,13 +38,14 @@
{{ define "book-section-children" }}
{{ with .Section }}
<ul>
{{ range where .Sections "Params.bookhidden" "!=" true }}
{{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage) }}
{{ end }}
{{ range where .Pages "Params.bookhidden" "!=" true }}
<li>
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
</li>
{{ range where .Pages "Params.bookhidden" "!=" "true" }}
{{ if eq .Kind "section" }}
{{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage) }}
{{ else if and (eq .Kind "page") .Content }}
<li>
{{- template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) -}}
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}