-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-node.js
46 lines (42 loc) · 1.06 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
exports.createPages = async ({ actions: { createPage }, graphql}) => {
console.log("holaa")
createPage({
path: "/no-data/",
component: require.resolve("./src/templates/no-data.js"),
})
createPage({
path: "/page-with-context/",
component: require.resolve("./src/templates/with-context.js"),
context: {
title: "We Don’t Need No Stinkin’ GraphQL!",
content: "<p>This is page content.</p><p>No GraphQL required!</p>",
},
})
const result = await graphql(`
{
graphql {
pages {
nodes {
id
uri
}
}
}
}
`)
// pull the page data out of the query response
const pages = result.data.graphql.pages.nodes
// loop through WordPress pages and create a Gatsby page for each one
pages.forEach(page => {
console.log("EEEEEE")
console.log(page)
createPage({
path: page.uri,
component: require.resolve("./src/templates/page-template.js"),
context: {
id: page.id,
jj: page.id,
},
})
})
}