Best approach to getting "next post"

Hi, I need to fetch the data of the “next post” on each post. This is for displaying a section to preview the next post.

For example, if I have post-01, post-02, post-03;

When querying the data of post-02, I would need to be able to get some data from post-03 (slug, title, image, …).

I worked with other CMS’s in the past that would “prev” & “next” keys available in GraphQL, but that’s not the case for Dato.

What would be the best approach here?

My current solution looks something like this:

query PostPage {
  _allPostsMeta {
  post(filter: {slug: {eq: "post-02"}}) {

# $position = ( + 1) % data._allPostsMeta.count

query NextPost($position) {
  nextPage: page(filter: {position: {eq: $position}}) {

Hello @dev15

You can use (orderBy: position_ASC) to order by the position, and then use pagination to iterate through the records Content Delivery API - Pagination - DatoCMS Docs