hugo-theme-relearn/layouts/partials/bodys/tree.html
Sören Weber c442e9fa5f
theme: remove recursive partial cached calls
this is a pitty and necessary since Hugo 0.146.7
https://discourse.gohugo.io/t/circular-call-stack-detected-for-recursive-partialcached-since-0-146-7/54559/5
maybe in a later release they may fix it but for now I am tired of discussing
2025-05-01 13:31:04 +02:00

37 lines
No EOL
1.5 KiB
HTML

{{- .Store.Set "relearnIsNested" true }}
{{- /* This wants to be partialCached but can't since Hugo 0.146.7 }}
{{- partialCached "inline/article-walker" . .Path | safeHTML */}}
{{- partial "inline/article-walker" . .Path | safeHTML }}
{{- define "partials/inline/article-walker" }}
{{- $html := "" }}
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
{{- range $pages }}
{{- if not (partialCached "_relearn/pageIsHidden.gotmpl" . .Path) }}
{{- /* This wants to be partialCached but can't since Hugo 0.146.7 }}
{{- $html = printf "%s%s" $html (partialCached "inline/article-walker" . .Path) */}}
{{- $html = printf "%s%s" $html (partial "inline/article-walker" . .Path) }}
{{- $child := . }}
{{- range .Site.Params.relearn.dependencies }}
{{- $has := printf "has%s" .name }}
{{- $hasnested := printf "relearnHasNested%s" .name }}
{{- $.Store.Set $hasnested (or ($.Store.Get $hasnested) ($child.Store.Get $hasnested) ($child.Store.Get $has)) }}
{{- end }}
{{- end }}
{{- end }}
{{- $article := "" }}
{{- if .Title }}
{{- $article = .Render "article" }}
{{- end }}
{{- if len $html }}
{{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }}
{{- $html = printf `%s
<section>
<h1 class="a11y-only">%s</h1>%s
</section>` $article (T "Subsections" $title | htmlEscape) $html }}
{{- else }}
{{- $html = $article }}
{{- end }}
{{- return $html }}
{{- end }}