cache sidebar smartly when building site (#7431)

This commit is contained in:
davidhauck 2020-05-29 09:17:03 -07:00 committed by GitHub
parent 55a4416230
commit b2da6a2a7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -42,7 +42,11 @@
<button{{ if not $collapse }} class="show"{{ end }} aria-hidden="true"></button><a {{ if eq $current.Permalink .Permalink }}class="current"{{ end }} title="{{ $desc }}" href="{{ .Permalink }}">{{ .LinkTitle}}</a>
{{ partial "sidebar_level.html" (dict "pages" $pages "parent" . "current" $current "collapse" $collapse "top" false "labelledby" "" ) }}
{{ if (.CurrentSection.IsAncestor $current) }}
{{ partial "sidebar_level.html" (dict "pages" $pages "parent" . "current" $current "collapse" $collapse "top" false "labelledby" "" ) }}
{{- else -}}
{{ partialCached "sidebar_level.html" (dict "pages" $pages "parent" . "current" $current "collapse" $collapse "top" false "labelledby" "" ) .CurrentSection }}
{{- end -}}
</li>
{{ else }}
<li role="none">

View File

@ -18,7 +18,11 @@
</button>
<div class="body{{if .IsAncestor $current}} default{{end}}" aria-labelledby="{{ $id }}" role="region" id="{{ $id }}-body">
{{ partial "sidebar_level.html" (dict "pages" $pages "parent" $page "current" $current "collapse" false "top" true "labelledby" $id ) }}
{{ if ($page.IsAncestor $current) }}
{{ partial "sidebar_level.html" (dict "pages" $pages "parent" $page "current" $current "collapse" false "top" true "labelledby" $id ) }}
{{ else }}
{{ partialCached "sidebar_level.html" (dict "pages" $pages "parent" $page "current" $current "collapse" false "top" true "labelledby" $id ) $page.CurrentSection }}
{{ end }}
</div>
</div>
{{ end }}