Closed rrelmy closed 8 months ago
Thank you for pointing this out, but what is the real problem this is causing for you?
As a workaround for https://github.com/statamic/ideas/issues/622 we started implementing our own tag finding the next/previous. In a very similar way as the CollectionTags
in v2 does.
Get all sibling pages by going ->parent()->pages()
and find the current page and take the next/previous one.
In the case of the example with the FAQ page parent is home and we get no pages, as a workaround we need to check for the home and take all the top-level pages instead.
Pseudocode
function getSiblingPages($page) {
if (isHome($page->parent())) {
return findAllTopLevelPages();
}
return $page->parent()->pages()->all()
}
Closing - this is working as intended.
Bug Description
Hard to describe as I am not sure if it is a real bug or it is just confusing behaviour. And it is most likely not possible to change as it would be a breaking change.
I call the root page a confused parent as it is defined as parent of other pages but itself has no children. While working with the page structure we were greeted with this unexpected behaviour.
How to Reproduce
Starting from an empty page
FAQs (slug: faqs)
Extra Detail
Environment
Statamic version: 3.1.31