How to display more than 100 documents with graphql?

Hi, in my project i have more than 100 documents per Custom Types to display, but the problem is that prismic graphql only return a maximum of 100 documents and the rest canot be fetch.

I see this documentation who explain how to paginate the results : but this way requires to duplicate the query and put a cursor id manually. What does not very flexible for a big project...

I currently use the old plugin gatsby-source-prismic-graphql but I haven't seen anything about the new gatsby-source-prismic plugin either.

Is there a way to automatize the pagination ? Or make a loop in a graphql query ? Is this possible with the new plugin gatsby-source-prismic ?

Thank you for your help !

Hello @baptiste, thanks for reaching out.

With the gatsby-source-prismic-graphql plugin you can only return 20 documents per request. This is because the plugin is based on Prismic’s GraphQL API. In that case, the documentation you need to read is the following:

The gatsby-source-prismic plugin, on the other hand, fetches the data using REST API. It does not have the limitation that GraphQL has. Here is the documentation to create pagination with Gatsby and this plugin:

If you need it, we have a dedicated guide to migrate from one plugin to the other one.

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