From 8678e82154226d31ff2833c83fc078d6260a218f Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Tue, 18 Sep 2018 01:35:54 +0200 Subject: Improve side menu rendering --- layouts/partials/docs/nav-filetree.html | 58 +++++++++++++++------------------ 1 file changed, 27 insertions(+), 31 deletions(-) (limited to 'layouts/partials/docs/nav-filetree.html') diff --git a/layouts/partials/docs/nav-filetree.html b/layouts/partials/docs/nav-filetree.html index 7c80ae2..6c2f965 100644 --- a/layouts/partials/docs/nav-filetree.html +++ b/layouts/partials/docs/nav-filetree.html @@ -1,51 +1,47 @@ -{{ template "book-get-root-section" . }} +{{ template "book-get-root-section" . }} - - - -{{ define "book-section" }} -
  • +{{- range .Scratch.Get "BookSections" -}} + {{ template "book-section" (dict "Section" . "CurrentPage" $.Permalink) }} +{{- end -}} - {{ with .Section}} +{{ define "book-section" }} + +{{ end }} - -
  • +{{ define "book-page-link" }} +{{- with .Page -}} + + {{- template "title" . -}} + +{{- end -}} {{ end }} {{ define "book-get-root-section" }} - + {{ $bookSection := default "docs" .Site.Params.BookSection }} {{ if eq $bookSection "*" }} {{ .Scratch.Set "BookSections" .Site.Sections }} {{ else }} {{ $bookSections := where .Site.Sections "Section" $bookSection }} {{ .Scratch.Set "BookSections" $bookSections }} - - {{ if eq (len $bookSections) 1 }} - {{ $singleSection := index $bookSections 0 }} - {{ .Scratch.Set "BookSections" $singleSection.Sections }} - {{ end }} {{ end }} {{ end }} \ No newline at end of file -- cgit v1.2.3