fix(rss): generate slug for rss

This commit is contained in:
Nicholas Young 2017-11-12 13:25:31 -07:00
parent 6a8ebec531
commit 315939b93c

View file

@ -1,6 +1,7 @@
const _ = require("lodash") const _ = require("lodash")
const Promise = require('bluebird') const Promise = require('bluebird')
const path = require('path') const path = require('path')
const { createFilePath } = require('gatsby-source-filesystem')
exports.createPages = ({ graphql, boundActionCreators }) => { exports.createPages = ({ graphql, boundActionCreators }) => {
const { createPage } = boundActionCreators const { createPage } = boundActionCreators
@ -42,3 +43,16 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
) )
}) })
} }
exports.onCreateNode = ({ node, boundActionCreators, getNode }) => {
const { createNodeField } = boundActionCreators
if (node.internal.type === `MarkdownRemark`) {
const value = createFilePath({ node, getNode })
createNodeField({
name: `slug`,
node,
value,
})
}
}