Skip to content

Instantly share code, notes, and snippets.

@diveddie
Created May 18, 2020 12:15
Show Gist options
  • Save diveddie/14c9e250535644e901e3b4175d4e9783 to your computer and use it in GitHub Desktop.
Save diveddie/14c9e250535644e901e3b4175d4e9783 to your computer and use it in GitHub Desktop.
This is a function to create pages based on blog information.
result.data.allContentfulBlogPost.edges.forEach(({ node }) => {
actions.createPage({
path: `/blogs/${replaceSpacesWithDashes(node.title)}_${
node.contentful_id
}`,
component: require.resolve(
`./src/components/InnerBlog/InnerBlog.tsx`
),
context: { data: node },
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment