Graphql 图ql"$id";“所需类型”;智力&引用;没有提供

Graphql 图ql"$id";“所需类型”;智力&引用;没有提供,graphql,gatsby,Graphql,Gatsby,我的代码有一些问题,我在和盖茨比合作,盖茨比的分页很棒 所以我不知道发生了什么,因为在《盖茨比发展》中,当我使用 盖茨比建筑上面说 GraphQL查询中出现错误: 未提供所需类型为“Int!”的变量“$id” 这是我在gatsby-node.js中的代码 const BlogPosts = result.data.allWordpressPost.edges paginate({ createPage, items: BlogPosts, itemsPerPa

我的代码有一些问题,我在和盖茨比合作,盖茨比的分页很棒

所以我不知道发生了什么,因为在《盖茨比发展》中,当我使用

盖茨比建筑上面说

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
          }
        }
      }
    }
  }
`
你能告诉我我做错了什么吗

谢谢

你的“Blog.js”不是在“src/pages”中吗

由于Gatsby core会自动将“src/pages”中的react组件转换为带有URL的页面,我建议您将“Blog.js”移动到“src/templates”

您的“Blog.js”不是在“src/pages”中吗

由于Gatsby core会自动将“src/pages”中的react组件转换为带有URL的页面,因此我建议您将“Blog.js”移动到“src/templates”