我们如何使用Gatsby-Source-Shopify插件从Gatsby的Shopify Headless中获取博客文章和页面?
我计划将我的网站从Shopify迁移到Shopify无头 + Gatsby,但我对插件盖茨比 - 苏格里式汇总有疑问。它可以为产品和产品相关的数据创建节点,而不是博客文章。有什么方法可以获取博客文章,还是我必须在盖茨比手动创建它们。
这是我针对盖茨比 - 源插件插件的配置。
resolve: `gatsby-source-shopify`,
options: {
password: process.env.GATSBY_SHOPIFY_PASSWORD,
storeUrl: process.env.GATSBY_SHOPIFY_STORE_URL,
shopifyConnections: ["collections"],
},
},
它在GraphQL中提供了产品和产品相关的节点。 GraphQl ScreenShot中的
节点专注于检索产品数据。
谢谢你们。
I am planning to migrate my site from Shopify to Shopify Headless + Gatsby but I am having a problem with the plugin, gatsby-source-shopify. It can create nodes for products and product related data but not blog posts. Is there any way to get blog posts or do I have to create them manually in Gatsby.
Here is my configuration for gatsby-source-shopify plugin.
resolve: `gatsby-source-shopify`,
options: {
password: process.env.GATSBY_SHOPIFY_PASSWORD,
storeUrl: process.env.GATSBY_SHOPIFY_STORE_URL,
shopifyConnections: ["collections"],
},
},
It gives products and product related nodes in GraphQL.
Available Nodes in GraphQL Screenshot
I try googling but all of the tutorials and gatsby-source-shopify documentation focus on retrieving product data.
Thank you guys.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您必须确保您的Env文件具有所有正确的凭据,以与您在Shopify创建的自定义应用程序建立正确的连接是正确的。
我的env文件:
env文件的图像
现在根据盖茨比文档,我们必须制作一个新的来源,我们称其为“店面”。您的gatsby-config.js文件应该看起来像这样。
-config.js的图像
gatsby 为你的盖茨比。如果一切顺利。您应该能够打开http:// localhost:8000/___ graphql或您正在运行的任何端口(您可以在终端中找到该信息)
终端图像
打开  http:// localhost:8000/___ graphql,您应该能够在Explorer中看到店面。
localhost graphql
创建查询并获取它
You first have to make sure your env file has all the right credentials to make a connection to your custom app that you have created in Shopify is correct.
my env file:
image of env file
Now according to Gatsby documentation, we have to make a new source and let’s call it a “storefront”. Your Gatsby-config.js file should look like this.
image of gatsby-config.js
Run “Gatsby clean” and then Gatsby develop command in the terminal for your Gatsby. If everything goes right. You should be able to open http://localhost:8000/___graphql or whatever port you are running on (you can find that information in the terminal)
terminal image
Open http://localhost:8000/___graphql and you should be able to see the storefront in Explorer.
localhost graphql
Create a query and fetch it