Creating Blog Page for listing

This commit is contained in:
Moris Zen
2018-07-05 20:43:56 +02:00
parent c01cbd3985
commit 5eb158ea28
3 changed files with 32 additions and 10 deletions

View File

@@ -22,13 +22,18 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
reject(result.errors)
}
createPage({
path: `/blog/`,
component: path.resolve('./src/templates/blog.js'),
})
result.data.allWordpressPost.edges.forEach(({ node }) => {
createPage({
path: `blog/${node.slug}`,
component: path.resolve('./src/templates/post-default.js'),
context: {
slug: node.slug,
}
},
})
})