What it should do: Return all pages (with or without sections) or current page.
My current solution consists of a partial named page-crawler.html
:
{{ $currentPage := .context }}
{{ $pages := default (slice) .pages }}
{{ with $currentPage.Pages }}
{{ range . }}
{{ if .IsPage }}
{{ $pages = $pages | append . }}
{{ end }}
{{ $subContext := . }}
{{ with .Pages }}
{{ $subpages := partial "page-crawler" (dict "context" $subContext) }}
{{ $pages = $pages | append $subpages }}
{{ end }}
{{ end }}
{{ end }}
{{ return $pages }}
Could this be done without a component?