Skip to content

Instantly share code, notes, and snippets.

@IliasHad
Created May 1, 2020 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IliasHad/e45da2225ebea6ff1eb16c50977c9ddf to your computer and use it in GitHub Desktop.
Save IliasHad/e45da2225ebea6ff1eb16c50977c9ddf to your computer and use it in GitHub Desktop.
const { createRemoteFileNode } = require("gatsby-source-filesystem")
exports.onCreateNode = async ({
node,
actions,
store,
cache,
createNodeId,
}) => {
const { createNode } = actions
if (node.internal.type === "googleSheetSheet1Row") {
const fileNode = await createRemoteFileNode({
url: node.featuredimage,
store,
cache,
createNode,
parentNodeId: node.id,
createNodeId,
})
if (fileNode) {
node.localFeaturedImage___NODE = fileNode.id
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment