added a graphql field for the link to the current markdown file on github

This commit is contained in:
Xetera
2019-07-29 19:35:55 -07:00
parent d5cd08918b
commit f18f92372a
2 changed files with 20 additions and 0 deletions
+8
View File
@@ -62,6 +62,14 @@ exports.onCreateNode = async ({ node, getNode, actions }) => {
const { frontmatter } = node
const isDoc = Boolean(!frontmatter.path)
const githubLink = helper.findMarkdownLink(node.fileAbsolutePath)
createNodeField({
node,
name: "githubLink",
value: githubLink,
})
if (!isDoc) {
return
}