Like .NextInSection in outline order?

I’m new to Hugo and still learning the basics. I’m using docsy theme. I have pages like this:


Based on weights, on the sidebar when collapsed it looks like:


In a partial I want to implement Next/Prev buttons that let me hit “next” and step right through the 4 items that look like peers in the outline: topic1 -> page1 -> topic2 -> page2.

But .NextInSection/.PrevInSection don’t work like that. They seem to only work for single pages within a topic. I want a next/prev that respects the order in the outline, without caring if something is a single page or a list page.

Is there a variable that corresponds to that notion of “next”? That can step through the items as they appear in the outline?

I tried just .Next/.Prev but I didn’t understand that order it all. It seemed to be unrelated to the displayed order in the sidebar.