Cannot find offset in graphQl queries

Hello,

I need to request allDocuments with pagination feature, and when i do so i can use the parameter first but there is no offset parameter.

The documentation on your website tells us that we can use offset for pagination.

Is it a lack of this feature or am i missing something?

Thanks a lot !

1 Like

Hi @sebastien.vassaux, thanks for reaching out about this. The documentation mentions that you can use the after and before parameters.

Unfortunately the Prismic GraphQL API doesn’t currently support offset. But I will pass this along to our dev team and add it to our feature request tracker as a possible improvement for the future.

Chiming in here to say that this is must! Especially that the prismic docs mention the official spec and the official spec tells us first and foremost about the ‘offset’ key.

At the very bottom: https://prismic.io/docs/graphql/query-the-api/paginate-your-results
First example: https://graphql.org/learn/pagination/#pagination-and-edges

Thanks, I’ll let our dev team know!

Hi, do you have any updates on this feature request (being able to do offset pagination with GraphQL) ?

We need this on our blog to comply with SEO's best practices.

Or for the time being, are there any workarounds to properly handle SEO without offset pagination (with GraphQL cursor-based pagination)?

Thanks!

Hello @yannick.tian, thanks for joining the conversation. At the moment, there is no news about the feature request.

Offset pagination is easy to implement, but it's prone to errors if your database is extensive. It needs to re-read the pages many times because it can't track the last requested record.

The cursor-based pagination standard is a more scalable option. It addresses issues that offset carries. It allows the server to use the cursor's index to perform efficient queries without having to read the same records repeatedly. Also, the results remain consistent. This improves the performance of your site. The only drawback of cursor-based pagination has is that the user needs to traverse all the pages as it uses the pagination.

Thanks for your reply @Pau
I totally agree that cursor-based pagination is more performant than offset pagination.

However in terms of SEO with cursor based pagination, it would lead to a large number of links as the content moves around due to more content being generated everyday. It will also lead to duplicated content, as multiple links may point to a bucket of content that was already covered in some other URL.

That's way I we believe that offset pagination would work better for SEO.

For the time being we'll just implement offset pagination with @prismicio/client but we will lose the power of GraphQL typings :slightly_frowning_face:

I understand why it isn't the best option for your project.
If we ever decide to implement this into the API, we'll give a public announcement.

1 Like

Hello team. We close the threads after a week with no new activity. If this happens and you want to continue the conversation, you can easily flag it to reopen it and add a new comment.

Thanks.

Threads close after a period of inactivity. Flag this thread to re-open it and continue the conversation.