Skip to content

Commit

Permalink
Simplify Ghost page creation code (#20524)
Browse files Browse the repository at this point in the history
  • Loading branch information
dandv authored and blainekasten committed Jan 10, 2020
1 parent 53f3f99 commit 3920194
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions docs/docs/sourcing-from-ghost.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ There are several ways to structure queries depending on how you prefer to work,
const path = require(`path`)

exports.createPages = async ({ graphql, actions, reporter }) => {
const { createPage } = actions
const postTemplate = path.resolve(`./src/templates/post.js`)

// Query Ghost data
Expand Down Expand Up @@ -96,9 +95,9 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
items.forEach(({ node }) => {
node.url = `/${node.slug}/`

createPage({
actions.createPage({
path: node.url,
component: path.resolve(postTemplate),
component: postTemplate,
context: {
slug: node.slug,
},
Expand Down

0 comments on commit 3920194

Please sign in to comment.