-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.js
40 lines (36 loc) · 984 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
const path = require('path')
exports.createPages = async ({graphql, actions}) => {
const {createPage} = actions
const result = await graphql(`
{
allPortfoliosYaml {
nodes {
photos {
caption
name
videoUrl
}
slug
title
description
}
}
}
`)
result.data.allPortfoliosYaml.nodes.forEach((node) => {
const {title, slug, description} = node
const { name, caption, videoUrl} = node.photos
// console.log("createPage", node, title, slug, name, caption)
createPage({
path: `/portfolios/${title}`,
component: path.resolve('./src/templates/gallery-query.js'),
context: {
name: title,
slug: slug,
caption: caption,
description: description,
videoUrl: videoUrl
}
})
})
}