GraphQL pagination using page number

Hi, we are building the blog/news part of our website. We need to paginate on all blog entries and we have page numbers in our design. We are currently using GraphQL to query the content.
After checking the documentation (Paginate your results with the Prismic GraphQL API - Prismic), we couldn't find a way to load contents on a specific page of the result set. We were able to iterate with like 10 blogs per page, but GraphQL does not seem to have a way to load an arbitrary page from the result set.

Can you please guide us on the way to implement pagination properly?

Thanks.

Hi Ekin,

Welcome to the community!

I'll be happy to help you with this. Can you tell me what framework you are using to build you application?

Thanks.

Hi,

We are using TypeScript and React. I'm trying to prepare a GraphQL query to be used by the front end developer using the GraphQL API browser.

Thank you,

ekin

Hello Eikin!

We have a sample project that uses GraphQl and has built-in pagination.

Here you can see a preview of how the site looks like.

Let us know if you find this example useful :grinning_face_with_smiling_eyes:

The full pagination is what we need to do. But the sample is loading all content from CMS and does the pagination on the client side. This is not something we would like to do, it will not scale well with hundreds of contents (code line: react-graphql-pagination-example/FullPagination.js at dc5a8082f2526cd06f94011dde0fd30f965b4988 · prismicio/react-graphql-pagination-example · GitHub).

Is there any way to query a specific page using GraphQL?

Any comments on GraphQL page=x support?

It depends on what you need to retrieve. You can query documents by their metadata (id, uid, lang, tags) or using a content field, like a number or a Rich Text field

Hi, we need the equivalent solution using page and pageSize parameters described on JS-API page for GraphQL-API.