{{ define "renderChildren" }} {{- $pages := .Pages }} {{- if .Params.sidebar.reverse }} {{ $pages = .Pages.Reverse }} {{- end }} {{- range $pages }} {{- if eq .Params.sitemap false }} {{- continue }} {{- end }} {{- if .IsSection }} {{- template "renderList" . }} {{- else }} {{- template "renderSingle" . }} {{- end }} {{- end }} {{ end }} {{/* Recursive template for sidebar items */}} {{ define "renderList" }} {{ $isCurrent := eq page . }} {{ $expanded := or $isCurrent (page.IsDescendant .) }}
  • {{- if .Permalink }} {{/* If the link is not empty, use it */}} {{ template "renderTitle" . }} {{- else }} {{/* Otherwise, just expand the section */}} {{- end }}
  • {{ end }} {{ define "renderSingle" }} {{- if .Params.sidebar.goto }}
  • {{ template "renderTitle" . }}
  • {{- else }} {{ $isCurrent := eq page . }}
  • {{ template "renderTitle" . }}
  • {{- end }} {{ end }} {{ define "renderTitle" }} {{ .LinkTitle }} {{- with .Params.sidebar.badge }} {{- partial "components/badge.html" (dict "color" .color "content" .text) }} {{- end }} {{ end }}