swarm
This commit is contained in:
43
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/docs/gatsby-node.js
generated
vendored
Normal file
43
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/docs/gatsby-node.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
const {createFilePath} = require('gatsby-source-filesystem')
|
||||
const path = require('path')
|
||||
|
||||
exports.onCreateNode = ({node, getNode, actions}) => {
|
||||
const {createNodeField} = actions
|
||||
if (node.internal.type === 'MarkdownRemark') {
|
||||
const slug = createFilePath({node, getNode, basePath: 'content', trailingSlash: false})
|
||||
createNodeField({
|
||||
node,
|
||||
name: 'slug',
|
||||
value: slug
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
exports.createPages = ({graphql, actions}) => {
|
||||
const {createPage} = actions
|
||||
return graphql(`
|
||||
{
|
||||
allMarkdownRemark {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
fields {
|
||||
slug
|
||||
}
|
||||
html
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`).then(result => {
|
||||
result.data.allMarkdownRemark.edges.forEach(({node}) => {
|
||||
createPage({
|
||||
path: node.fields.slug,
|
||||
component: path.resolve('./src/templates/Page.js'),
|
||||
context: {
|
||||
slug: node.fields.slug
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user