{{ $bookSection := default "/" .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) */}}
    {{ range (where .Section.Pages "Params.bookhidden" "ne" true) }} {{ if .IsSection }}
    {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }} {{ template "book-section-children" (dict "Section" . "CurrentPage" $.CurrentPage) }}
    {{ else if and .IsPage .Content }}
  1. {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
  2. {{ end }} {{ end }}
{{ end }} {{ define "book-page-link" }}{{/* (dict "Page" .Page "CurrentPage" .CurrentPage) */}} {{ $current := eq .CurrentPage .Page }} {{ $ancestor := .Page.IsAncestor .CurrentPage }} {{ if .Page.Params.bookCollapseSection }} {{ else if .Page.Content }} {{- partial "title" .Page -}} {{ else }} {{- partial "title" .Page -}} {{ end }} {{ end }}