forked from drowl87/hextra_mirror
		
	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