Next and Previous record?

Is there neat way in the content API to grab a next/previous record?

So for example if i was to query ‘article’ with url eq slug, i would want to return the records either side also.

At the moment I was planning to use the publish date and then do a second query with date GT that date, but it would be nice to do it in one query.

The case I’d like to achieve is to show a link to the next article at the end of an article

many thanks

Hey @jack1

If you are using the orderBy attribute, both the REST and the GraphQL API will return a list of records ordered by that certain attribute, so iterating through the list should return you the “next” record according to the attribute you specified on orderBy