[4.x] Remove requirement of orderable collection from next/prev tags #8810
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At the moment, the
collection:next
/prev
tags only work on dated or orderable collections. "Orderable" collections are ones with a structure set to max depth of 1.This was because the "order" was ambiguous for multi-depth collections. A while ago in #4883 we made the decision for it to just assume the order is depth-first (how it looks if you read down the page while looking at the tree).
We never looped back and added support for that within the collection:next/prev tags.
This PR removes that requirement. If you want to sort by
order
, go for it. You can technically even sort a dated collection by order if you add anorder
field to each entry.The default sort order of a multi-depth structured collection is
title
. Since we don't want to make it a breaking change, to get these tags to work, you'll need to addsort="order"
. In Statamic 5 we will change the default sort order of a multi-depth structured collection toorder
.