Skip to content

Commit

Permalink
Removes dead codes in gatsby-node.js
Browse files Browse the repository at this point in the history
  • Loading branch information
LesleyLai committed Oct 9, 2018
1 parent 0b11f5b commit 31e6833
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions gatsby-node.js
@@ -1,24 +1,4 @@
const path = require('path');

exports.onCreateNode = ({ node, actions, getNode }) => {
const { createNodeField } = actions;
let relativePath;
if (node.internal.type === `MarkdownRemark`) {
const fileNode = getNode(node.parent);
const parsedFilePath = path.parse(fileNode.relativePath);
if (parsedFilePath.name !== `index` && parsedFilePath.dir !== ``) {
relativePath = `/${parsedFilePath.dir}/${parsedFilePath.name}/`;
} else if (parsedFilePath.dir === ``) {
relativePath = `/${parsedFilePath.name}/`;
} else {
relativePath = `/${parsedFilePath.dir}/`;
}

// Add relativePath as a field on the node.
createNodeField({ node, name: `relativePath`, value: relativePath });
}
};

const { createFilePath } = require(`gatsby-source-filesystem`);

exports.onCreateNode = ({ node, getNode, actions }) => {
Expand Down

0 comments on commit 31e6833

Please sign in to comment.