Order of nodes is random

Created on 6 June 2023, almost 2 years ago
Updated 3 November 2023, over 1 year ago

Problem/Motivation

PrevNext (Previous/Next) is a simple module that provides, for any node type you want, two links to the previous and to the next node of the same type.

The module description is not clear about what the expected order of nodes is. Currently, no order is set on the query, which causes the prev/next arrows to be shown in an unpredictable way. Currently I have a situation where a node has no next node, even though it doesn't have the highest nid or the latest created date. We should decide on a field to order by, just to make sure the result is consistent across database engines/versions (more info about default sorts in SQL).

Proposed resolution

I think most of the time, the results are currently sorted by nid in a reverse order. This has the side effect that most of the time, the most recent node is considered first, with older nodes following it. Another option would be to sort by created date, but that might be considered a breaking change, I'm not sure.

Remaining tasks

Decide on a default sort and add it to the query.

πŸ“Œ Task
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024