Skip to content

Instantly share code, notes, and snippets.

@rayriffy
Created May 4, 2019 18:46
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 rayriffy/f9548acc2c57421833f0b21a1c5c6af8 to your computer and use it in GitHub Desktop.
Save rayriffy/f9548acc2c57421833f0b21a1c5c6af8 to your computer and use it in GitHub Desktop.
/**
* Generate page from dynamic URLs that match RegExp
*/
exports.onCreatePage = async ({page, actions}) => {
const {createPage} = actions
if (page.path.match(/^\/g/)) {
page.matchPath = '/g/*'
createPage(page)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment