Is there some kind of a .NextInSection variable for branch bundles?
I want to create next/previous article links, but when I get to the first/last article in a bundle, I want to link to the neighboring branch bundle. I tried .Parent.NextInSection, but that returns nil, since this only works for regular pages, and the _index.md of a branch bundle is not one of them.
What I want to achieve is that when I reach the end of article2 in section1, I get a link to _index.md in section2.
So I tried {{ with .Parent.Parent.Pages.Prev/Next . }}{{ .Permalink }}{{ end }}, but that returns nil, even though just {{ .Parent.Parent.Pages }} returns Pages(6).
Then I tried {{ with .Parent.Parent.Pages.Next .Parent }}{{ .Permalink }}{{ end }} and I’m getting somewhere, but something’s odd: if I’m in section3/lastArticle.md, I get a permalink to section1/_index.md instead of nil, which is what I’d expect.
What am I doing wrong? I can’t wrap my head around the contexts here ;/
OK, after some dabbling, which worked but turned out not to do what I wanted done, I took a completely different approach.
Our page is a wild jumble of logical pages and sections that do not follow Hugo’s normal structures, so I decided to create a slice of the articles I have in the order that I want them (based on the logic that builds our current menus) and I create the next/prev links from the pages stored at the indices before and after the current page.
I’ll have to sit down and re-design this whole documentation someday, but wouldn’t the world be a much better place in general if everyone had the time to break free from technological debt?
Thanks for the effort anyway, I’ve learned some new things!