-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add graphql schema item and dummy resolver for related resources
- Loading branch information
1 parent
53053ef
commit d36afbc
Showing
3 changed files
with
79 additions
and
7 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
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
21 changes: 21 additions & 0 deletions
21
plugins/gatsby-source-swiftype/src/createRelatedResourceNode.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,21 @@ | ||
module.exports = ({ | ||
createNode, | ||
createNodeId, | ||
createContentDigest, | ||
resource, | ||
parentPathname, | ||
}) => { | ||
createNode({ | ||
...resource, | ||
id: createNodeId(`RelatedResource-${resource.url}`), | ||
parent: null, | ||
children: [], | ||
plugin: 'gatsby-source-swiftype', | ||
parentPathname, | ||
internal: { | ||
type: 'RelatedResource', | ||
content: JSON.stringify(resource), | ||
contentDigest: createContentDigest(resource), | ||
}, | ||
}); | ||
}; |