Last active
June 7, 2017 10:42
-
-
Save craigmulligan/25c85839d4083dd5df7beb6c06a57902 to your computer and use it in GitHub Desktop.
programatically create page from plugin
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
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