Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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