mirror of
https://github.com/oceanprotocol/market.git
synced 2024-11-15 01:34:57 +01:00
27 lines
580 B
JavaScript
27 lines
580 B
JavaScript
|
const { createFilePath } = require('gatsby-source-filesystem')
|
||
|
|
||
|
function createMarkdownFields(node, actions, getNode) {
|
||
|
const { createNodeField } = actions
|
||
|
|
||
|
// Automatically create slugs for specific node types,
|
||
|
// relative to ./content/
|
||
|
const { type } = node.internal
|
||
|
|
||
|
if (type === 'MarkdownRemark') {
|
||
|
// Create a slug from the file path & name
|
||
|
const slug = createFilePath({
|
||
|
node,
|
||
|
getNode,
|
||
|
trailingSlash: false
|
||
|
})
|
||
|
|
||
|
createNodeField({
|
||
|
name: 'slug',
|
||
|
node,
|
||
|
value: slug
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = createMarkdownFields
|