Querying all documents of a type to list them on a Page

Hi there,

I've used the old Rest API plugin for Gatsby for a while and switched to the new GraphQL one recently.
I'm trying to wrap my head around the pagination thing but i have a probably simple question that i just can't make work on my own. I know that there are only 20 results at a time and thats exactly my problem.

I'm trying to do a simple page where i list all items of one content type (unpaginated just every single one). How do i do a Page Query for that kind of thing? I know i can do it with cursors somehow but i just dont get how to do a recursive query in Gatsby.

I hope someone could help me out here, thank you very much!
Have a great Day,
Andreas

Hi,

Welcome to Prismic community, if understood correctly you need to fetch all the documents for a particular custom type.

To achieve that you can fetch the pages recursively, here is an example in GraphQL-React.js that has a different type of pagination implementation.

Please let us know if you need any further help.

Best,
Fares

I have the same problem. I have about 30 pages and can only query 20 at a time. It would be nice if Prismic could add a tutorial of how to query all pages with Gatsby. I don’t really understand the example in React. Should it also work the same way in Gatsby as in the example you linked above?

Thanks!

Hi Frida,

Welcome to the Prismic community.

I will check with our @Prismic-Support-Team if we have already an example in Gatsby or how to do this in Gatsby otherwise I try to reserve some time to create such a snippet.

Hi Frida,

We apologize for the long delay but in fact, we didn't have time to reserve to draft an example.

So I will check with my team if someone can draft some code, know that the new example with not be done with the old Birkir plugin but with this https://github.com/angeloashmore/gatsby-source-prismic

@Prismic-Support-Team can somebody reserve some time to draft an example of pagination in Gatsby

This issue has been closed due to inactivity. Flag to reopen.