-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.js
44 lines (42 loc) · 1021 Bytes
/
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
const path = require(`path`);
exports.createPages = async ({ actions, graphql }) => {
const [references] =
await Promise.all([
graphql(`
query {
allNodeReferencePage {
edges {
node {
id
langcode
drupal_internal__nid
path {
alias
}
imageids
relationships {
field_topics {
drupal_internal__tid
}
}
}
}
}
}
`),
]);
};
references.data.allNodeReferencePage.edges.map((edge) => {
if (edge.node.path.alias) {
actions.createPage({
path: edge.node.path.alias,
component: path.resolve(`./src/templates/reference.tsx`),
context: {
id: edge.node.id,
nid: edge.node.drupal_internal__nid,
locale: edge.node.langcode,
},
});
}
});
};