Skip to content

Instantly share code, notes, and snippets.

@JacobKnaack
Created January 24, 2019 18:51
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 JacobKnaack/e28314ce02035eb4f359c97a0d121d6a to your computer and use it in GitHub Desktop.
Save JacobKnaack/e28314ce02035eb4f359c97a0d121d6a to your computer and use it in GitHub Desktop.
initial gatsby node without createPages
require("dotenv").config();
/**
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
exports.onCreatePage = ({ page, actions }) => {
const { createPage, deletePage } = actions
deletePage(page)
createPage({
...page,
context: {
writeKey: `${process.env.COSMIC_WRITE_KEY}`,
readKey: `${process.env.COSMIC_READ_KEY}`,
cosmicBucket: `${process.env.COSMIC_BUCKET}`
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment