Skip to content

Instantly share code, notes, and snippets.

@craigmulligan
Last active June 7, 2017 10:42
Show Gist options
  • Save craigmulligan/25c85839d4083dd5df7beb6c06a57902 to your computer and use it in GitHub Desktop.
Save craigmulligan/25c85839d4083dd5df7beb6c06a57902 to your computer and use it in GitHub Desktop.
programatically create page from plugin
const path = require(`path`)
const slash = require(`slash`)
module.exports = ({ graphql, boundActionCreators }) => {
const { createPage } = boundActionCreators
const postTemplate = path.resolve(`${__dirname}/templates/changelog.js`)
createPage({
// Each page is required to have a `path` as well
// as a template component. The `context` is
// optional but is often necessary so the template
// can query data specific to each page.
path: `/changelog/`,
component: slash(postTemplate),
context: {
entries: []
},
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment