text: const path = require(`path`)
  const { createFilePath } = require(`gatsby-source-filesystem`)
  
  exports.onCreateNode = ({ node, getNode, actions }) => {
    const { createNodeField } = actions
    if (node.internal.type === `Mdx`) {
      const slug = createFilePath({ node, getNode, basePath: `pages` })
      createNodeField({
        node,
        name: `slug`,
        value: slug,
      })
    }
  }
  
  exports.createPages = async ({ graphql, actions }) => {
    const { createPage } = actions
    const result_notes = await graphql(`
      query {
        allMdx(filter: { fileAbsolutePath: { regex: "/notes/" } }) {
          edges {
            node {
              fields {
                slug
              }
            }
          }
        }
      }
    `)
  
    result_notes.data.allMdx.edges.forEach(({ node }) => {
      createPage({
        path: node.fields.slug,
        component: path.resolve(`./src/templates/note-post.js`),
        context: {
          // Data passed to context is available
          // in page queries as GraphQL variables.
          slug: node.fields.slug,
        },
      })
    })
  
    const result_blogs = await graphql(`
      query {
        allMdx(filter: { fileAbsolutePath: { regex: "/blogs/" } }) {
          edges {
            node {
              fields {
                slug
              }
            }
          }
        }
      }
    `)
  
    result_blogs.data.allMdx.edges.forEach(({ node }) => {
      createPage({
        path: node.fields.slug,
        component: path.resolve(`./src/templates/blog-post.js`),
        context: {
          // Data passed to context is available
          // in page queries as GraphQL variables.
          slug: node.fields.slug,
        },
      })
    })
  }
  