1

I need the sys.id to be passed into my props via pageContext. How do I grap this? If I add sys{id} anywhere within my graphql query, it breaks.

return new Promise((resolve, reject) => { const PageTemplate = path.resolve('./src/templates/Page.jsx') resolve( graphql( { allContentfulPage{ edges { node { id slug } } } } ).then(result => {

    if (result.errors) {
      console.log(result.errors)
      reject(result.errors)
    }

    result.data.allContentfulPage.edges.forEach((edge) => {
      createPage({
        path: edge.node.slug,
        component: PageTemplate,
        context: {
          id: edge.node.id,
          slug: edge.node.slug
        }
      })
    })
    return
Danny
  • 77
  • 1
  • 8
  • Did you figure this one out? When trying to query a field from sys I get error: Cannot query field \"sys\" – nunof Dec 12 '19 at 17:51
  • Yes. If you are using Gatsby, go to http://localhost:8000/___graphql. You can build out our queries there. – Danny Dec 12 '19 at 19:35
  • Yes, I know that. Still, that doesn't answer the question. I was never able to query the "sys" fields. Instead, I ended up querying the "internal" field which worked for what I wanted. – nunof Dec 15 '19 at 18:08

0 Answers0