{{ .Scratch.Set "breadcrumbMaxDepth" 0 }} {{ template "breadcrumbcount" (dict "p1" . "scratch" .Scratch) }} {{ define "breadcrumbcount" }} {{ .scratch.Set "breadcrumbMaxDepth" (add 1 (.scratch.Get "breadcrumbMaxDepth")) }} {{ if .p1.Parent }} {{ if not .p1.Parent.IsHome }} {{ template "breadcrumbcount" (dict "p1" .p1.Parent "scratch" .scratch) }} {{ end }} {{ else if not .IsHome }} {{ template "breadcrumbcount" (dict "p1" .p1.Site.Home "scratch" .scratch) }} {{ end }} {{ end }} {{ define "breadcrumbnav" }} {{ if .p1.Parent }} {{ if not .p1.Parent.IsHome }} {{ template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2 "depth" (add .depth 1) "scratch" .scratch ) }} {{ end }} {{ else if not .p1.IsHome }} {{ template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2 "depth" (add .depth 1) "scratch" .scratch) }} {{ end }} {{ $isActive := eq .p1 .p2 }}