[英]Shopify GraphQL Pagination Without Using Cursor
I have read the tutorial for pagination using the parameter after:cursor
in this article https://shopify.dev/concepts/graphql/pagination .我在这篇文章https://shopify.dev/concepts/graphql/pagination中阅读了使用参数
after:cursor
的分页教程。 Unfortunately, I cannot use this because I want to generate a sitemap for all the products.不幸的是,我不能使用它,因为我想为所有产品生成站点地图。 As you know, we can only get 250 products maximum at a single graphql request.
如您所知,在单个 graphql 请求中,我们最多只能获得 250 个产品。 What I am building is something like this:
我正在构建的是这样的:
sitemaps/products-1-250.xml
sitemaps/products-251-500.xml
sitemaps/products-501-750.xml
and so on...等等...
I want to make some query like this where I can get products from 251 to 500:我想做一些这样的查询,我可以得到从 251 到 500 的产品:
query GetAllProductsForSitemap {
products(first: 250, page: 2) {
edges {
node {
id
title
other-attributes
}
}
}
}
But of course, page
is not a valid parameter.当然,
page
不是一个有效的参数。
Is this achievable in Shopify-GraphQL?这在 Shopify-GraphQL 中可以实现吗?
Why don't you just take the perfect sitemap for all your products that are generated for free for you by Shopify?您为什么不为 Shopify 免费为您生成的所有产品获取完美的站点地图? Any reason you are re-inventing the wheel?
你有什么理由重新发明轮子?
As for your request, the short answer is no.至于您的要求,简短的回答是否定的。 One uses cursors when using the GraphQL API for data.
在使用 GraphQL API 获取数据时使用游标。 Alternatively, you are 100% free to use paging with the RestAPI, so if you have to, you can.
或者,您可以 100% 自由地使用 RestAPI 进行分页,所以如果必须,您可以。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.