Skip to content

Instantly share code, notes, and snippets.

@danilowoz
Created April 28, 2019 19:49
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 danilowoz/aeb45b65526dd264469980929caccbd9 to your computer and use it in GitHub Desktop.
Save danilowoz/aeb45b65526dd264469980929caccbd9 to your computer and use it in GitHub Desktop.
Getting the categories
const categories = []
posts.forEach((post, index) => {
post.node.frontmatter.category.forEach(cat => categories.push(cat))
createPage({
path: post.node.fields.slug,
component: blogLayout,
context: {
slug: post.node.fields.slug,
},
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment