Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getNode,
createNodeId,
loadNodeContent,
createContentDigest,
}) => {
if (node.internal.type !== 'Mdx') return
const parent = getNode(node.parent)
if (parent.sourceInstanceName !== source) return
const id = createNodeId(`${node.id} >>> MdxRecipe`)
const filepath = createFilePath({
node: parent,
getNode,
basePath: source,
})
const slug = urlResolve(basePath, filepath)
await actions.createNode({
id,
name: node.frontmatter.name || filepath,
slug,
parent: node.id,
children: [],
internal: {
type: 'MdxRecipe',
contentDigest: createContentDigest(node.rawBody),
},
content: node.rawBody,
description: 'Code recipes',
})
actions.createParentChildLink({