title: How to progamatically create pages in gatsby with a CMS backend?
body: <p>I have a Django CMS that serves as my back-end application. And I'm trying to create pages dynamically in my Gatsby front-end site. My Django application is exposed over GraphQL using Graphene. But I'm not able to query the slugs from backend CMS and create pages using <code>gatsby-node.js</code>. How do I create pages when I create a page in the back-end application?</p>
  <p>The idea being</p>
  <pre><code>//gatsby-node.js
  
  exports.createPages = ({ graphql, actions }) =&gt; {
      const pages = graphql`
          {
              blogPages{
                  edges{
                      node{
                          slug     // this slug supposed to come from the backend CMS (Atleast i think)
                      }
                  }
              }
          }
      `;
  
      const { createPage } = actions
      const blogTemplate = path.resolve(`src/templates/blogTemplate.js`);
  
      pages.blogPages.edges.forEach(edge =&gt; {   //this should help to create dynamic pages - slug coming from backend CMS
        const slug = edge.node.blogpage.slug;
        createPage({
          path: slug,
          component: blogTemplate
      })  
    })
  }
  </code></pre>