Getting the Next & Previous Posts through the Ghost API

I have a SPA (EmberJS) where I’m calling the API and would like to get the Next and Previous post. Is there a simple way to do this?

return fetch(`https://**********&include=tags&limit=10`).then(response => {
    return response.json();

@Mithrilhall what do next and previous refer to in your context? I’m assuming you have a post otherwise next/previous doesn’t make a great deal of sense but do you want to find next/prev with particular tags, within all posts, inside a specific group of posts?

FYI, a good reference for how you may do it is the {{prev/next}} helper source

@Kevin, I do indeed have a post. I’m looking for the next/prev within all posts (by publish date I suppose).

@Kevin, is this possible from within something like Postman?

I probably should have put in the original post that I’m trying to do this with the content api.

Something like this would work…I’m just not sure on the syntax around the date:



I think I figured out what I needed:



Did you finally get the next & prev post ?

I try with


But API seems to be not recognizing the Date format

I am using aditional parameters


@damr67, is there a reason you’re not using the Ghost SDK to generate urls? Your url is not correctly formatted which is why you’re running into issues. For example, the < symbol is illegal


I performed two fetches using the following URLs.

Next was this:<key>&include=author,authors,tags&filter=published_at:>${published_at}%2Bslug:-${params.slug}&order=published_at&limit=1

Previous was this:<key>&include=author,authors,tags&filter=published_at:<=${published_at}%2Bslug:-${params.slug}&limit=1

I hope this helps.

1 Like

Thanks @Mithrilhall

I hope this helps

:smiley: :ok_hand:Helps a lot.

I did 2 api requests as well + The blog Post itseltf.

Please do not forget to add


at the end of your query if you want results from newest to oldest articles. Some times api returns unexpected results

1 Like