mirror of
https://github.com/imfing/hextra.git
synced 2025-07-09 19:12:20 -04:00
chore: cache tree branch without leaf
This commit is contained in:
@ -3,11 +3,16 @@
|
||||
{{- $pageLink := .page.RelPermalink -}}
|
||||
{{- range .tree -}}
|
||||
{{- $active := eq $pageLink .link -}}
|
||||
{{- $shouldOpen := or (.open) (hasPrefix $pageLink .link) $active | default true }}
|
||||
{{- $containsPage := hasPrefix $pageLink .link -}}
|
||||
{{- $shouldOpen := or (.open) $containsPage $active | default false }}
|
||||
<li class="{{ if $shouldOpen }}open{{ end }}">
|
||||
{{- template "sidebar-item-link" (dict "context" . "active" $active "title" .title "link" .link) -}}
|
||||
{{- if .section -}}
|
||||
{{- partial "sidebar/render-tree-branch" (dict "context" $context "entry" .section "page" $page) -}}
|
||||
{{- 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 -}}
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{ end }}
|
||||
|
Reference in New Issue
Block a user