-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-node.js
48 lines (47 loc) · 1.26 KB
/
gatsby-node.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const path = require(`path`)
const slash = require(`slash`)
const PHOTOS = "Photos"
const TEXT = "Text"
exports.createPages = async ({ graphql, actions }) => {
// const { createPage } = actions
// const photoPostTemplate = path.resolve(
// `./src/templates/photo-post-template.tsx`
// )
// const textPostTemplate = path.resolve(
// `./src/templates/text-post-template.tsx`
// )
// const result = await graphql(`
// {
// allWordpressPost {
// edges {
// node {
// id
// slug
// categories {
// name
// }
// }
// }
// }
// }
// `)
// if (result.errors) {
// throw result.errors
// }
// result.data.allWordpressPost.edges.forEach(edge => {
// const { node } = edge
// createPage({
// // will be the url for the page
// path: node.slug,
// // specify the component template of your choice
// component: node.categories.some(({ name }) => name === TEXT)
// ? textPostTemplate
// : null,
// // In the ^template's GraphQL query, 'id' will be available
// // as a GraphQL variable to query for this posts's data.
// context: {
// id: node.id,
// },
// })
// })
}