refactor: only use dasherized superBlock (#41067)

This commit is contained in:
Oliver Eyton-Williams
2021-02-13 06:06:04 +01:00
committed by GitHub
parent 73f8377d68
commit 97fcaa693f
22 changed files with 68 additions and 87 deletions

View File

@ -20,9 +20,7 @@ exports.onCreateNode = function onCreateNode({ node, actions, getNode }) {
const { createNodeField } = actions;
if (node.internal.type === 'ChallengeNode') {
const { tests = [], block, dashedName, superBlock } = node;
const slug = `/learn/${dasherize(superBlock)}/${dasherize(
block
)}/${dashedName}`;
const slug = `/learn/${superBlock}/${dasherize(block)}/${dashedName}`;
createNodeField({ node, name: 'slug', value: slug });
createNodeField({ node, name: 'blockName', value: blockNameify(block) });
createNodeField({ node, name: 'tests', value: tests });
@ -131,7 +129,7 @@ exports.createPages = function createPages({ graphql, actions, reporter }) {
result.data.allChallengeNode.edges.map(
({ node: { superBlock } }) => superBlock
)
).map(superBlock => blockNameify(superBlock));
);
// Create intro pages
result.data.allMarkdownRemark.edges.forEach(edge => {