{{ template "book-get-root-section" . }} {{- range .Scratch.Get "BookSections" -}} {{ template "book-section" (dict "Section" . "CurrentPage" $.Permalink) }} {{- end -}} {{ 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 }} {{ end }} {{ end }}