# Get the Next and Previous Posts Through the Ghost API

**URL:** <https://forum.ghost.org/t/get-the-next-and-previous-posts-through-the-ghost-api/6168>\
**Category:** Developer help\
**Created:** [March 11, 2019, 7:26pm UTC](https://forum.ghost.org/t/get-the-next-and-previous-posts-through-the-ghost-api/6168 "2019-03-11T19:26:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zicklag](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/zicklag/32/1910_2.png) [@zicklag](https://forum.ghost.org/u/zicklag)\
**Post date:** [March 11, 2019, 7:26pm UTC](https://forum.ghost.org/t/get-the-next-and-previous-posts-through-the-ghost-api/6168/1 "2019-03-11T19:26:09Z")

</div>

I am creating a custom SPA frontend to my ghost site using [Quasar](https://v1.quasar-framework.org) and the Ghost Content API, but I can’t find anything in the API that can get me the previous and next posts given the post that I am currently on. Is there any way to do this?

---

<div class="post-metadata">

**Author:** ![Kate](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kate/32/35_2.png) [@Kate](https://forum.ghost.org/u/Kate)\
**Post date:** [March 11, 2019, 7:43pm UTC](https://forum.ghost.org/t/get-the-next-and-previous-posts-through-the-ghost-api/6168/2 "2019-03-11T19:43:33Z")

</div>

You need to filter & limit the request to your Content API v2 using the [Ghost-SDK](https://docs.ghost.org/api/javascript/).

You could take a look at the existing [prev/next helper](https://github.com/TryGhost/Ghost/blob/2.16.4/core/server/helpers/prev_next.js) implementation in Ghost.

* * *

_Furthermore, take a look at our [JavaScript SDK helpers](https://docs.ghost.org/api/javascript/sdk/#helpers). We are working on making more and more of Ghost’s theme helpers available as general JavaScript helpers…but we’ve just started 🙂_

---

<div class="post-metadata">

**Author:** ![zicklag](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/zicklag/32/1910_2.png) [@zicklag](https://forum.ghost.org/u/zicklag)\
**Post date:** [March 11, 2019, 8:29pm UTC](https://forum.ghost.org/t/get-the-next-and-previous-posts-through-the-ghost-api/6168/3 "2019-03-11T20:29:03Z")

</div>

Perfect! Thank you, that’s exactly what I needed. I was going to need that read time helper too!

---

<div class="post-metadata">

**Author:** ![zicklag](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/zicklag/32/1910_2.png) [@zicklag](https://forum.ghost.org/u/zicklag)\
**Post date:** [March 11, 2019, 9:11pm UTC](https://forum.ghost.org/t/get-the-next-and-previous-posts-through-the-ghost-api/6168/4 "2019-03-11T21:11:08Z")

</div>

> [@Kate](#):
>
> [prev/next helper](https://github.com/TryGhost/Ghost/blob/2.16.4/core/server/helpers/prev_next.js.)

This link has a `.` at the end that breaks it and causes a 404, could you fix that for anybody else who finds this? :)

---

<div class="post-metadata">

**Author:** ![Kate](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kate/32/35_2.png) [@Kate](https://forum.ghost.org/u/Kate)\
**Post date:** [March 11, 2019, 11:20pm UTC](https://forum.ghost.org/t/get-the-next-and-previous-posts-through-the-ghost-api/6168/5 "2019-03-11T23:20:35Z")

</div>

Fixed 🤣Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/b/ba9ce5100b8bb264586f4f572545596b2ce3f081.png) [@system](https://forum.ghost.org/u/system)\
**Post date:** [March 26, 2019, 12:39pm UTC](https://forum.ghost.org/t/get-the-next-and-previous-posts-through-the-ghost-api/6168/7 "2019-03-26T12:39:45Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
