我的代码有问题,我正在使用Gatsby和Gatsby Awesome分页,
所以我不知道发生了什么,因为在[[gatsby development上正在工作,但是当我使用时
gatsby build
它说GraphQL查询中存在错误:所需类型为“ Int!”的变量“ $ id”未提供。
这是我在gatsby-node.js中的代码 const BlogPosts = result.data.allWordpressPost.edges
paginate({
createPage,
items: BlogPosts,
itemsPerPage: 10,
itemsPerFirstPage: 10,
pathPrefix: '/blog',
component: path.resolve('./src/pages/blog.js'),
})
BlogPosts.forEach(post => {
createPage({
path: `/${post.node.slug}`,
component: BlogSinglePage,
context: {
id: post.node.wordpress_id,
},
})
})
这是我在Blog.js中的代码
export const query = graphql` query ($skip: Int!, $limit: Int!) { allWordpressPost( skip: $skip limit: $limit ) { edges { node { wordpress_id title excerpt slug date(formatString: "YYYY-MM-DD") categories { name slug } featured_media { source_url } } } } } `
你能告诉我我在做什么错谢谢!!!