Back to Buildpacks

Sidebar

themes/buildpacks/layouts/partials/sidebar.html

latest1.0 KB
Original Source

{{- $currentNode := . -}}{{- define "section-tree-nav" }} {{- $parentExpanded := .parentExpanded }} {{- $currentNode := .currentNode }} {{- $expand := .expand }} {{- $depth := .depth }} {{- with .currentSection}} {{- if (not (.Params.hidden))}} {{- $isCurrent := (eq .RelPermalink $currentNode.RelPermalink) -}} {{- $isParent := (and (.IsAncestor $currentNode) (.IsSection)) -}} {{- $isCollapsed := (and (gt $depth 0) (not (or $isParent $isCurrent $expand))) }} {{- $numberOfPages := (add (len .Pages) (len .Sections)) }} {{- safeHTML .Params.head}}

  • {{safeHTML .Params.Pre}}{{.Title | markdownify}}{{safeHTML .Params.Post}} {{- if ne $numberOfPages 0 }} {{- $depth = add (int $depth) 1 }} {{- $expand = (or .Params.expand $isCurrent) -}} {{- $pages := (.Pages | union .Sections) }} {{- range $pages.ByWeight }} {{- if (not .Params.hidden) }} {{- template "section-tree-nav" dict "currentSection" . "currentNode" $currentNode "depth" $depth "expand" (or $expand $isParent) }} {{- end}} {{- end}} {{- end}} {{- end}} {{- end}} {{- end}}