-
Notifications
You must be signed in to change notification settings - Fork 1
/
gatsby-config.js
119 lines (116 loc) · 2.78 KB
/
gatsby-config.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
const config = require("./config")
const plugins = [
"gatsby-plugin-sass",
"gatsby-plugin-sharp",
"gatsby-remark-images",
{
resolve: "gatsby-plugin-svgr",
options: {
prettier: true,
svgo: false,
},
},
"gatsby-plugin-react-helmet",
{
resolve: "gatsby-source-filesystem",
options: {
name: "content",
path: `${__dirname}/content/`,
},
},
{
resolve: "gatsby-plugin-mdx",
options: {
extensions: [".md", ".mdx"],
remarkPlugins: [require("remark-math")],
gatsbyRemarkPlugins: [
{
resolve: "gatsby-remark-images",
options: {
maxWidth: 1200,
showCaptions: true,
backgroundColor: "transparent",
},
},
{
resolve: "gatsby-remark-prismjs",
options: {
classPrefix: "language-",
inlineCodeMarker: null,
},
},
],
},
},
"gatsby-plugin-preact",
"gatsby-plugin-linaria",
{
resolve: `gatsby-progress-bar`,
options: {
showSpinner: false,
color: "#3884ff",
},
},
"gatsby-plugin-sitemap",
{
resolve: "gatsby-plugin-robots-txt",
options: {
host: "https://cprog.netlify.app",
sitemap: "https://cprog.netlify.app/sitemap.xml",
policy: [{ userAgent: "*", allow: "/" }],
},
},
]
// check and add pwa functionality
if (
process.env.NODE_ENV == "production" &&
config.pwa &&
config.pwa.enabled &&
config.pwa.manifest
) {
plugins.push({
resolve: `gatsby-plugin-manifest`,
options: { ...config.pwa.manifest },
})
plugins.push({
resolve: "gatsby-plugin-offline",
options: {
workboxConfig: {
globPatterns: ["**/icons/*"],
runtimeCaching: [
{
// page-data.json files, static query results and app-data.json
// are not content hashed
urlPattern: /^https?:.*\/page-data\/.*\.json/,
handler: `NetworkFirst`,
options: {
networkTimeoutSeconds: 1,
},
},
],
},
},
})
} else {
plugins.push("gatsby-plugin-remove-serviceworker")
}
module.exports = {
pathPrefix: config.gatsby.pathPrefix,
siteMetadata: {
title: config.siteMetadata.title,
description: config.siteMetadata.description,
docsLocation: config.siteMetadata.docsLocation,
ogImage: config.siteMetadata.ogImage,
favicon: config.siteMetadata.favicon,
logo: {
link: config.header.logoLink ? config.header.logoLink : "/",
image: config.header.logoImage,
}, // backwards compatible
headerTitle: config.header.title,
githubUrl: config.header.githubUrl,
helpUrl: config.header.helpUrl,
headerLinks: config.header.links,
siteUrl: config.gatsby.siteUrl,
},
plugins,
}