-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-node.js
128 lines (121 loc) · 2.47 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
const path = require('path')
exports.createPages = async ({ graphql, actions }) => {
const { createPage } = actions
const artists = await graphql(`
{
allPrismicArtist {
nodes {
uid
}
}
}
`)
artists.data.allPrismicArtist.nodes.forEach((node) => {
createPage({
path: `/line-up/${node.uid}`,
component: path.resolve(__dirname, 'src/templates/artist.js'),
context: {
uid: node.uid
}
})
})
const lineups = await graphql(`
{
allPrismicLineup {
nodes {
uid
}
}
}
`)
lineups.data.allPrismicLineup.nodes.forEach((node) => {
createPage({
path: `/${node.uid}`,
component: path.resolve(__dirname, 'src/templates/lineup.js'),
context: {
uid: node.uid
}
})
})
const pages = await graphql(`
{
allPrismicPage {
nodes {
uid
}
}
}
`)
pages.data.allPrismicPage.nodes.forEach((node) => {
createPage({
path: `/${node.uid}`,
component: path.resolve(__dirname, 'src/templates/page.js'),
context: {
uid: node.uid
}
})
})
const schedules = await graphql(`
{
allPrismicSchedule {
nodes {
uid
}
}
}
`)
schedules.data.allPrismicSchedule.nodes.forEach((node) => {
createPage({
path: `/${node.uid}`,
component: path.resolve(__dirname, 'src/templates/schedule.js'),
context: {
uid: node.uid
}
})
})
/*
* Event pages are treated like their own landing page
* with potentiaL sub pages.
*/
const eventhomepages = await graphql(`
{
allPrismicEventhomepage {
nodes {
uid
}
}
}
`)
eventhomepages.data.allPrismicEventhomepage.nodes.forEach((node) => {
createPage({
path: `/${node.uid}`,
component: path.resolve(__dirname, 'src/templates/eventHomePage.js'),
context: {
uid: node.uid
}
})
})
const eventpages = await graphql(`
{
allPrismicEventpage {
nodes {
uid
data {
event_link {
uid
}
}
}
}
}
`)
eventpages.data.allPrismicEventpage.nodes.forEach((node) => {
createPage({
path: `${node.data.event_link.uid}/${node.uid}`,
component: path.resolve(__dirname, 'src/templates/eventPage.js'),
context: {
uid: node.uid
}
})
})
}