2024-04-14 11:12:17 +01:00
|
|
|
{{- $page := .page -}}
|
|
|
|
{{- $pageLink := $page.RelPermalink -}}
|
2024-04-29 22:36:48 +01:00
|
|
|
{{- $cached := .cached | default false }}
|
2024-04-14 11:12:17 +01:00
|
|
|
|
|
|
|
{{- range .data -}}
|
2024-04-29 22:36:48 +01:00
|
|
|
{{- $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 -}}
|
2024-04-14 11:31:13 +01:00
|
|
|
{{- $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 -}}
|
2024-04-29 22:36:48 +01:00
|
|
|
{{- partial "components/sidebar/render-items" (dict "items" .items "link" $pageLink "cached" $cached) -}}
|
2024-04-14 11:12:17 +01:00
|
|
|
{{- end -}}
|
|
|
|
</li>
|
|
|
|
{{ end }}
|