Hi there, I have a site structured similar to this.
content
├── _index.md
├── contact.md
├── docs
│ ├── _index.md
│ └── section1
│ │ ├── _index.md
│ │ ├── how
│ │ │ └── index.md
│ │ ├── where
│ │ │ └── index.md
│ │ └── why
│ │ └── index.md
│ └── section2
│ ├── _index.md
│ ├── advanced
│ │ └── index.md
│ └── super-advanced
│ └── index.md
└── help.md
I wish to list pages for navigation based on subsections and to provide a next/prev button for the previous or next page within the subscription.
Ideally, I started with this to list all pages which shares the same parent, so within section1
I should find 3 pages only
<!-- Retrieve the current Parent page -->
{{ $cur := .Parent }}
<!-- Range across pages where the parent is the same as the actual page -->
{{ range where .Site.Pages.ByWeight ".Parent" "$cur"}}
{{ .Permalink }}
{{end}}
Although, it returns blank. I tried to change quotes, remote the dot before Parent
but nothing.
I tried with this also
{{ $pages := where site.Pages "Parent" .Parent }}
{{ print $pages}}
But the output is
Page(/docs/section1/_index.md) Pages(0)
I feel like I’m complicating stuff with no result. Any direction or idea?
Thanks in advance!