New getPost api siblings

For ‘next’ and ‘previous’ post buttons, we now need instead of two or even three api calls: the post itself and a list with fields from multiple posts.

I would welcome an new include parameter, siblings. This would allow me to only have one api call to display a post in our website. I would suggest to use an include parameters, in addition to tags and authors:

    const post = await api.posts
    .read({
      slug: '123456abcdef',
      include: 'tags,authors,siblings',
    })
    .catch((err) => {
      return { statusCode: 404, message: 'getPost() failed' }
    })

which would return, besides the normal parameters:

post : {
  id: 'sdfasdsadas',
  slug: '123456abcdef'
  // ...
  siblings :{
    previous: {
       title: 'This is a previous post, based on the publication dates'
       slug: '7777xxxxyyyy'
    },
   next: {
       title: 'This is a next post, based on the publication dates'
       slug: '999aaabbb'
    },
  },
  // ... 
}

Looks like a duplicate of Include Prev/Next Post URL in Content API Read Requests - #2 by Kevin

1 Like