From 13430a68d172ce519a36b5cc9460ca0ce90f772e Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Fri, 2 Jun 2017 13:37:24 -0700 Subject: [PATCH] update starter blog for alpha18 --- gatsby-node.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gatsby-node.js b/gatsby-node.js index bfe80bf..c622719 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -5,7 +5,7 @@ const select = require(`unist-util-select`) const fs = require(`fs-extra`) exports.createPages = ({ graphql, boundActionCreators }) => { - const { upsertPage } = boundActionCreators + const { createPage } = boundActionCreators return new Promise((resolve, reject) => { const pages = [] @@ -33,7 +33,7 @@ exports.createPages = ({ graphql, boundActionCreators }) => { // Create blog posts pages. _.each(result.data.allMarkdownRemark.edges, edge => { - upsertPage({ + createPage({ path: edge.node.fields.slug, // required component: blogPost, context: { @@ -47,15 +47,15 @@ exports.createPages = ({ graphql, boundActionCreators }) => { } // Add custom slug for blog posts to both File and MarkdownRemark nodes. -exports.onNodeCreate = ({ node, boundActionCreators, getNode }) => { - const { addFieldToNode } = boundActionCreators +exports.onCreateNode = ({ node, boundActionCreators, getNode }) => { + const { createNodeField } = boundActionCreators if (node.internal.type === `File`) { const parsedFilePath = path.parse(node.relativePath) const slug = `/${parsedFilePath.dir}/` - addFieldToNode({ node, fieldName: `slug`, fieldValue: slug }) + createNodeField({ node, fieldName: `slug`, fieldValue: slug }) } else if (node.internal.type === `MarkdownRemark`) { const fileNode = getNode(node.parent) - addFieldToNode({ + createNodeField({ node, fieldName: `slug`, fieldValue: fileNode.fields.slug,