fix(rss): generate slug for rss
This commit is contained in:
parent
6a8ebec531
commit
315939b93c
1 changed files with 14 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
const _ = require("lodash")
|
||||
const Promise = require('bluebird')
|
||||
const path = require('path')
|
||||
const { createFilePath } = require('gatsby-source-filesystem')
|
||||
|
||||
exports.createPages = ({ graphql, 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,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue