nav: fix breadcrumb for huge installations #446

This commit is contained in:
Sören Weber 2023-01-26 00:08:25 +01:00
parent 26988d262b
commit 5ed690f68b
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
2 changed files with 11 additions and 1 deletions

View file

@ -0,0 +1,9 @@
{{- /* https://discourse.gohugo.io/t/how-to-know-the-section-depth/37302/4 */ -}}
{{- $page := .page }}
{{- $depth := .depth | default 0 }}
{{- with $page.Parent }}
{{- $depth = add $depth 1 }}
{{- partial "get-page-depth.hugo" (dict "page" . "depth" $depth) }}
{{- else }}
{{- $depth }}
{{- end }}

View file

@ -144,7 +144,8 @@
{{- $page := .page }}
{{- $to := .to }}
{{- $breadcrumb = $breadcrumb | append $to }}
{{- range seq (len .to.Site.AllPages) }}
{{- $depth := int (partial "get-page-depth.hugo" (dict "page" $page)) }}
{{- range seq $depth }}
{{- $to = $to.Parent }}
{{- if $to }}
{{- $breadcrumb = $breadcrumb | append $to }}