const path = require('path') const { createFilePath } = require(`gatsby-source-filesystem`) exports.createPages = async ({ actions, graphql }) => { const {createPage} = actions; const courseTemplate = path.resolve(`./src/components/courseTemplate.js`); const result = await graphql(`{ allMarkdownRemark( filter: {frontmatter: { content_type: {eq: "page_education"}, published: {eq: true}}} ){ edges{ node{ html frontmatter{ title path } } } } }`) if(result.errors){throw result.errors;} const courses = result.data.allMarkdownRemark.edges; courses.forEach(({node}) => { createPage({ path: node.frontmatter.path, component: courseTemplate }) }) }