Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 544cf9b
Showing
6 changed files
with
2,463 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
/gatsby-node.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
src | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// noop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "gatsby-remark-source-name", | ||
"version": "1.0.0", | ||
"description": "Add a custom sourceName field to remark nodes", | ||
"main": "index.js", | ||
"repository": "https://www.github.com/elboman/gatsby-remark-source-name", | ||
"author": "Marco Botto", | ||
"license": "MIT", | ||
"private": false, | ||
"keywords": [ | ||
"gatsby", | ||
"gatsby-plugin", | ||
"remark", | ||
"source", | ||
"name", | ||
"sourceName" | ||
], | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-preset-env": "^1.7.0", | ||
"cross-env": "^5.1.5", | ||
"standard-version": "^4.3.0" | ||
}, | ||
"scripts": { | ||
"build": "cross-env BABEL_ENV=production babel src --out-dir .", | ||
"prepublishOnly": "yarn build", | ||
"release": "standard-version" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
exports.onCreateNode = ({ node, getNode, boundActionCreators }) => { | ||
const { createNodeField } = boundActionCreators; | ||
|
||
// We only care about MarkdownRemark content. | ||
if (node.internal.type !== 'MarkdownRemark') { | ||
return; | ||
} | ||
|
||
const fileNode = getNode(node.parent); | ||
|
||
createNodeField({ | ||
node, | ||
name: 'sourceName', | ||
value: fileNode.sourceInstanceName, | ||
}); | ||
}; |
Oops, something went wrong.