{{ $bookSection := default "docs" .Site.Params.BookSection }} {{ if eq $bookSection "*" }} {{ $bookSection = "/" }}{{/* Backward compatibility */}} {{ end }} {{ with .Site.GetPage $bookSection }} {{ template "book-section-children" (dict "Section" . "CurrentPage" $) }} {{ end }} {{ define "book-section-children" }}{{/* (dict "Section" .Section "CurrentPage" .CurrentPage) */}} {{ $self := eq .CurrentPage .Section }} {{ $ancestor := .Section.IsAncestor .CurrentPage }} {{ $collapsed := .Section.Params.bookCollapseSection }} {{ if or $self $ancestor (not $collapsed) }} {{ end }} {{ end }} {{ define "book-page-link" }}{{/* (dict "Page" .Page "CurrentPage" .CurrentPage) */}} {{ if .Page.Content }} {{- partial "docs/title" .Page -}} {{ else }} {{- partial "docs/title" .Page -}} {{ end }} {{ end }}