Skip to content

Commit 578baab

Browse files
committed
bugfix: only want the basename of the dir
1 parent 6829c2f commit 578baab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/gatsby-node.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const crypto = require('crypto');
2+
const path = require('path');
23
const jsYaml = require('js-yaml');
34
const _ = require(`lodash`);
45

@@ -14,15 +15,15 @@ async function onCreateNode({ node, boundActionCreators, loadNodeContent }) {
1415
.createHash(`md5`)
1516
.update(JSON.stringify(obj))
1617
.digest(`hex`);
18+
const nodeDir = path.basename(node.dir);
1719
const yamlNode = {
1820
...obj,
1921
id: obj.id ? obj.id : `${node.id} >>> YAML`,
2022
children: [],
2123
parent: node.id,
2224
internal: {
2325
contentDigest,
24-
// Note `node.dir` vs `node.name`
25-
type: _.upperFirst(_.camelCase(`${node.dir}Yaml`)),
26+
type: _.upperFirst(_.camelCase(`${nodeDir}Yaml`)),
2627
},
2728
};
2829

0 commit comments

Comments
 (0)