{{/* inspired by https://github.com/alex-shpak/hugo-book/blob/master/layouts/partials/docs/menu-filetree.html */}} {{ $section := default "/" .Site.Params.BookSection }} {{ if eq $section "*" }} {{ $section = "/" }} {{/* Backward compatibility */}} {{ end }} {{ with .Site.GetPage $section }} {{ template "folder-children" (dict "Section" . "CurrentPage" $) }} {{ end }} {{ define "folder-children" }}{{/* (dict "Section" .Section "CurrentPage" .CurrentPage) */}} {{ end }} {{ define "children-link" }}{{/* (dict "Page" .Page "CurrentPage" .CurrentPage) */}} {{ $current := eq .CurrentPage .Page }} {{- partial "title" .Page -}} {{ end }}