forked from drowl87/hextra_mirror
17 lines
721 B
HTML
17 lines
721 B
HTML
{{- $page := .page -}}
|
|
{{- $pageLink := $page.RelPermalink -}}
|
|
{{- $cached := .cached | default false }}
|
|
|
|
{{- range .data -}}
|
|
{{- $active := and (not $cached) (or (eq $pageLink .link) (eq (strings.TrimSuffix "/" $pageLink) .link)) -}}
|
|
{{- $containsPage := hasPrefix $pageLink .link -}}
|
|
{{- $shouldOpen := or (.open) $containsPage $active | default false -}}
|
|
|
|
<li class="hextra-sidebar-item {{ if $shouldOpen }}open{{ end }}">
|
|
{{- 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) -}}
|
|
{{- end -}}
|
|
</li>
|
|
{{ end }}
|