Thanks, I tried to understand the idea and I think it is a kind of recursive walk.
But I have the problem of how to get my pages so I can work recursively.
It seems that I can get the first level (Kind=section) with:
{{- range $firstLevel := .Site.Sections }}
<p>1: Section: Title: {{ .Title }}, isSection: {{ .IsSection }}, Kind: {{ .Kind }}, Type: {{ .Type }}, Link: {{ .Permalink }}, Prev: {{ if .PrevInSection }}{{ .PrevInSection.Permalink }}{{ end }}, Next: {{ if .NextInSection }}{{ .NextInSection.Permalink }}{{ end }}</p>
<p>1.1 Next: {{ with .Next }}{{ .Permalink }}{{ end }}, Prev: {{ with .Prev }}{{ .Permalink }}{{ end }}</p>
<p>1.2 Current: {{ .CurrentSection }}</p>
<p>1.3 FirstSection: {{ .FirstSection }}</p>
<p>1.4 Sections: {{ .Sections }}</p>
<p>1.5 Pages: {{ .Pages }}</p>
{{- range $secondLevel := $firstLevel.Pages }}
<p>2: Section: Title: {{ .Title }}, isSection: {{ .IsSection }}, Kind: {{ .Kind }}, Type: {{ .Type }}, Link: {{ .Permalink }}</p>
{{- end}}
{{- end }}
But I’m not able to find the second level which would be e.g. the directory freebsd, it returns the following:
1: Section: Title: Posts, isSection: true, Kind: section, Type: posts, Link: http://localhost:1313/posts/, Prev: , Next:
1.1 Next: , Prev:
1.2 Current: Page(/posts)
1.3 FirstSection: Page(/posts)
1.4 Sections: Pages(0)
1.5 Pages: Pages(170)
2: Section: Title: Cloud backup with rsync, isSection: false, Kind: page, Type: posts, Link: http://localhost:1313/posts/freebsd/cloud_backup/
2: Section: Title: Acme.sh, isSection: false, Kind: page, Type: posts, Link: http://localhost:1313/posts/freebsd/acme/
2: Section: Title: Convert from Dokuwiki to Hugo, isSection: false, Kind: page, Type: posts, Link: http://localhost:1313/posts/hugo/convert_from_dokuwiki/
2: Section: Title: HAProxy, isSection: false, Kind: page, Type: posts, Link: http://localhost:1313/posts/freebsd/haproxy/
2: Section: Title: Poudriere, isSection: false, Kind: page, Type: posts, Link: http://localhost:1313/posts/freebsd/poudriere/
2: Section: Title: Install FreeBSD, isSection: false, Kind: page, Type: posts, Link: http://localhost:1313/posts/netcup/install_freebsd/
2: Section: Title: Remote Reboot, isSection: false, Kind: page, Type: posts, Link: http://localhost:1313/posts/windows/remote_reboot/
2: Section: Title: ZFS, isSection: false, Kind: page, Type: posts, Link: http://localhost:1313/posts/freebsd/zfs/
2: Section: Title: Update FreeBSD, isSection: false, Kind: page, Type: posts, Link: http://localhost:1313/posts/freebsd/upgrade/
...
I tried also to play with functions:
{{ if $secondLevel.IsDecendant $firstLevel }}
...
But this does not work, it seems that IsDecendant does not exist:
Could you please help me how I can find the certain pieces in hierarchy.
Hierarchy Level 1:
Hierarchy Level 2:
Hierarchy Level 3 in FreeBSD: