Skip to content

Instantly share code, notes, and snippets.

@christiannwamba
Created January 30, 2018 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiannwamba/2d8ccec573564b9b1ae4779ca6934d0f to your computer and use it in GitHub Desktop.
Save christiannwamba/2d8ccec573564b9b1ae4779ca6934d0f to your computer and use it in GitHub Desktop.
const { createFilePath } = require(`gatsby-source-filesystem`)
const path = require(‘path’)
exports.onCreateNode = ({ node, getNode, boundActionCreators }) => {
const { createNodeField } = boundActionCreators
if (node.internal.type === `MarkdownRemark`) {
const slug = createFilePath({ node, getNode, basePath: `pages` })
createNodeField({
node,
name: `slug`,
value: slug,
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment