feat(guide): add footer link to article source on GitHub

fix/suggested-changes
This commit is contained in:
moT01
2019-03-11 08:38:38 -05:00
committed by mrugesh mohapatra
parent 24802779be
commit ebe420c099
4 changed files with 63 additions and 1 deletions

View File

@ -4,6 +4,7 @@ const { createFilePath } = require('gatsby-source-filesystem');
const { dasherize } = require('./utils');
const { blockNameify } = require('./utils/blockNameify');
const { getGithubPath } = require('./utils/getGithubPath');
const {
createChallengePages,
createBlockIntroPages,
@ -33,10 +34,16 @@ exports.onCreateNode = function onCreateNode({ node, actions, getNode }) {
const slug = createFilePath({ node, getNode });
if (!slug.includes('LICENSE')) {
const {
fileAbsolutePath,
frontmatter: { component = '' }
} = node;
createNodeField({ node, name: 'slug', value: slug });
createNodeField({ node, name: 'component', value: component });
createNodeField({
node,
name: 'githubPath',
value: getGithubPath(fileAbsolutePath)
});
}
}
};
@ -79,6 +86,7 @@ exports.createPages = function createPages({ graphql, actions }) {
slug
nodeIdentity
component
githubPath
}
frontmatter {
block