17 lines
721 B
HTML
Raw Normal View History

2024-04-14 11:12:17 +01:00
{{- $page := .page -}}
{{- $pageLink := $page.RelPermalink -}}
{{- $cached := .cached | default false }}
2024-04-14 11:12:17 +01:00
{{- range .data -}}
{{- $active := and (not $cached) (or (eq $pageLink .link) (eq (strings.TrimSuffix "/" $pageLink) .link)) -}}
2024-04-14 11:12:17 +01:00
{{- $containsPage := hasPrefix $pageLink .link -}}
{{- $shouldOpen := or (.open) $containsPage $active | default false -}}
2024-04-14 11:12:17 +01:00
2024-04-30 23:54:06 +01:00
<li class="hextra-sidebar-item {{ if $shouldOpen }}open{{ end }}">
2024-04-14 11:12:17 +01:00
{{- partial "components/sidebar/item-link" (dict "active" $active "title" .title "link" .link "items" .items) -}}
{{- if .items -}}
{{- partial "components/sidebar/render-items" (dict "items" .items "link" $pageLink "cached" $cached) -}}
2024-04-14 11:12:17 +01:00
{{- end -}}
</li>
{{ end }}