Creating latest posts pages and not pages dynamically for now

This commit is contained in:
Moris Zen
2018-06-27 10:35:17 +02:00
parent 7a67da8bb6
commit 8dc66673d0
2 changed files with 10 additions and 12 deletions

View File

@@ -6,12 +6,10 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
graphql(
`
{
allWordpressPage {
allWordpressPost {
edges {
node {
id
slug
title
}
}
}
@@ -23,10 +21,10 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
reject(result.errors)
}
result.data.allWordpressPage.edges.forEach(({ node }) => {
result.data.allWordpressPost.edges.forEach(({ node }) => {
createPage({
path: node.slug,
component: path.resolve('./src/pages/page-default.js'),
path: `blog/${node.slug}`,
component: path.resolve('./src/pages/post-default.js'),
context: {
slug: node.slug,
}