-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.js
38 lines (34 loc) · 951 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
const blog = require('./bootstrap/blog')
const links = require('./bootstrap/links')
const other = require('./bootstrap/other')
const tags = require('./bootstrap/tags')
exports.createPages = async ({ actions, graphql }) => {
await blog.createPages(actions, graphql)
await links.createPages(actions, graphql)
await other.createPages(actions, graphql)
await tags.createPages(actions, graphql)
}
exports.createSchemaCustomization = ({ actions, schema }) => {
const { createTypes, createFieldExtension } = actions
createFieldExtension({
name: `defaultFalse`,
extend() {
return {
resolve(source, args, context, info) {
if (source[info.fieldName] == null) {
return false
}
return source[info.fieldName]
},
}
},
})
createTypes(`
type MarkdownRemark implements Node {
frontmatter: Frontmatter
}
type Frontmatter {
draft: Boolean @defaultFalse
}
`)
}