text: const path = require(`path`);
  
  exports.createPages = async ({actions, graphql, reporter}) => {
    const {createPage} = actions;
  
    const blogPostTemplate = path.resolve(`src/templates/blog.js`);
  
    const result = await graphql(`
      {
        allMarkdownRemark(
          sort: { order: DESC, fields: [frontmatter___date] }
          limit: 1000
        ) {
          edges {
            node {
              frontmatter {
                path
              }
            }
          }
        }
      }
    `);
  
    // Handle errors
    if (result.errors) {
      reporter.panicOnBuild(`Error while running GraphQL query.`);
      return
    }
  
    result.data.allMarkdownRemark.edges.forEach(({node}) => {
      createPage({
        path: node.frontmatter.path,
        component: blogPostTemplate,
        context: {}, // additional data can be passed via context
      })
    })
  };
  
  exports.onCreatePage = async ({ page, actions }) => {
    const { createPage } = actions;
    if (page.path.match(/^\/account/)) {
      page.matchPath = "/account/*";
      createPage(page)
    }
  };
  
  exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
    if (stage === 'build-html') {
      // Exclude Sign-In Widget from compilation path
      actions.setWebpackConfig({
        module: {
          rules: [
            {
              test: /okta-sign-in/,
              use: loaders.null(),
            }
          ],
        },
      })
    }
  };