exports.modifyWebpackConfig = ({config}) => {
  config.merge({
    resolve: {
      root: `${__dirname}/src`,
      extensions: ['', '.js', '.jsx', '.json', '.css', '.module.css'],
    }
  })
  return
}

exports.onNodeCreate = ({ node, boundActionCreators, getNode }) => {
  const { updateNode } = boundActionCreators

  if ( node.type === `MarkdownRemark`) {
    const fileNode = getNode(node.parent)
    node.slug = fileNode.slug
    if (node.frontmatter.path) {
        const path = node.frontmatter.path
        fileNode.slug = `/blog${path}`
        node.slug = `/blog${path}`
    }
    updateNode(node)
  }
}

exports.createPages = ({ graphql, boundActionCreators }) => {
  const { upsertPage } = boundActionCreators

    return new Promise((resolve, reject) => {
        const pages = []
        const blogPost = `${__dirname}/src/components/BlogPost/index.js`
        graphql(
            `
            {
                allMarkdownRemark(limit: 1000, frontmatter: { draft: { ne: true }}) {
                    edges {
                        node {
                            slug
                        }
                    }
                }
            }
            `
        ).then(result => {
            if (result.errors) {
                console.log(result.errors)
                resolve()
            }

            Object.keys(result.data.allMarkdownRemark.edges).forEach(key => {
                const edge = result.data.allMarkdownRemark.edges[key]
                upsertPage({
                    path: edge.node.slug,
                    component: blogPost,
                    context: {
                        slug: edge.node.slug,
                    }
                })
            })

            resolve()
        })
    })
}

@@ -1,16 +1,46 @@
+const path = require(%22path%22)%0A%0A
 exports.modifyWe
@@ -288,32 +288,34 @@
 getNode %7D) =%3E %7B%0A
+  
   const %7B update
@@ -348,15 +348,16 @@
 rs%0A%0A
+  
   if (
- 
 node
@@ -371,213 +371,542 @@
 == %60
-MarkdownRemark%60) %7B%0A    const fileNode = getNode(node.parent)%0A    node.slug = fileNode.slug%0A    if (node.frontmatter.path) %7B%0A        const path = node.frontmatter.path%0A        fileNode.slug = %60/blog$%7Bpath%7D%60
+File%60 && typeof node.slug === %22undefined%22) %7B%0A        const parsedFilePath = path.parse(node.absolutePath)%0A        const slug = %60/blog/$%7BparsedFilePath.dir.split(%22---%22)%5B1%5D%7D/%60%0A        node.slug = slug%0A        updateNode(node)%0A    %7D else if ( node.type === %60MarkdownRemark%60 && typeof node.frontmatter.slug !== %22undefined%22 ) %7B%0A        node.slug = %60/blog/$%7Bnode.frontmatter.slug%7D/%60%0A        updateNode(node)%0A    %7D else if ( node.type === %60MarkdownRemark%60 && typeof node.slug === %22undefined%22 ) %7B%0A        const fileNode = getNode(node.parent)
 %0A   
@@ -926,29 +926,26 @@
 g = 
-%60/blog$%7Bpath%7D%60
+fileNode.slug
 %0A    
-%7D%0A
     
@@ -961,16 +961,18 @@
 e(node)%0A
+  
   %7D%0A%7D%0A%0Ae

Update slug creation