2023-10-24 22:22:57 +01:00
|
|
|
{{- $context := .context -}}
|
|
|
|
{{- $page := .page -}}
|
|
|
|
{{- $pageLink := .page.RelPermalink -}}
|
|
|
|
{{- range .tree -}}
|
|
|
|
{{- $active := eq $pageLink .link -}}
|
2023-10-24 22:52:10 +01:00
|
|
|
{{- $containsPage := hasPrefix $pageLink .link -}}
|
|
|
|
{{- $shouldOpen := or (.open) $containsPage $active | default false }}
|
2023-10-24 22:22:57 +01:00
|
|
|
<li class="{{ if $shouldOpen }}open{{ end }}">
|
|
|
|
{{- template "sidebar-item-link" (dict "context" . "active" $active "title" .title "link" .link) -}}
|
|
|
|
{{- if .section -}}
|
2023-10-24 22:52:10 +01:00
|
|
|
{{- if not $containsPage -}}
|
|
|
|
{{- partialCached "sidebar/render-tree-branch-without-leaf" .section .section -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- partial "sidebar/render-tree-branch" (dict "context" $context "entry" .section "page" $page) -}}
|
|
|
|
{{- end -}}
|
2023-10-24 22:22:57 +01:00
|
|
|
{{- end -}}
|
|
|
|
</li>
|
|
|
|
{{ end }}
|