forked from rudderlabs/rudderstack-docs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gatsby-node.js
38 lines (34 loc) · 978 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
if (!process.env.GATSBY_SANITY_TOKEN) {
exports.sourceNodes = ({ actions, createNodeId, createContentDigest }) => {
const { createNode } = actions
const POST_NODE_TYPE = 'SanitySiteSettings'
const post = {
_rawWebsiteScripts: ['test'],
}
createNode({
...post,
id: createNodeId(`${POST_NODE_TYPE}`),
parent: null,
children: [],
internal: {
type: POST_NODE_TYPE,
contentDigest: createContentDigest(post),
},
})
}
}
exports.onPostBuild = () => {
const fs = require('fs')
/*
* If sitemap exists in /public/sitemaps folder, move sitemap-0.xml
* to root folder (/public) & rename to sitemap-docs.xml
*/
if (fs.existsSync('./public/sitemaps/sitemap-0.xml')) {
fs.renameSync(
'./public/sitemaps/sitemap-0.xml',
'./public/sitemap-docs.xml'
)
/* Remove the /public/sitemaps folder */
fs.rmSync('./public/sitemaps', { recursive: true, force: true })
}
}