-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
100 lines (95 loc) · 3.41 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
// ─────────────────────────────────────────────────────────────────────────────
// import
// ─────────────────────────────────────────────────────────────────────────────
const proxy = require('http-proxy-middleware');
// ─────────────────────────────────────────────────────────────────────────────
// component
// ─────────────────────────────────────────────────────────────────────────────
const {
NODE_ENV,
URL: NETLIFY_PRODUCTION_URL = 'https://www.gatsby-starter-netlify_cms.netlify.com', // TODO: update default
DEPLOY_PRIME_URL: NETLIFY_DEPLOY_URL = NETLIFY_PRODUCTION_URL,
CONTEXT: NETLIFY_ENV = NODE_ENV,
} = process.env;
module.exports = {
siteMetadata: {
siteTitle: 'Example', // TODO: update default
siteUrl: NETLIFY_ENV === 'production' ? NETLIFY_PRODUCTION_URL : NETLIFY_DEPLOY_URL,
},
developMiddleware: (app) => {
app.use(
'/.netlify/functions/',
proxy({
target: 'http://localhost:34567',
pathRewrite: { '/.netlify/functions/': '' },
}),
);
},
plugins: [
{ resolve: '@mrozilla/gatsby-theme-netlify_cms' },
{
resolve: 'gatsby-plugin-google-analytics',
options: {
trackingId: process.env.GATSBY_GA_TRACKING_ID,
head: true,
anonymize: true,
respectDNT: true,
},
},
{
resolve: 'gatsby-plugin-manifest',
options: {
name: 'Example', // TODO: update default
short_name: 'Example', // TODO: update default
start_url: '/',
background_color: '#ffffff',
theme_color: '#007bff', // TODO: update default
display: 'minimal-ui',
icon: 'static/assets/favicon.png', // TODO: update default
},
},
{
resolve: 'gatsby-plugin-robots-txt',
options: {
resolveEnv: () => process.env.CONTEXT,
env: {
production: {
policy: [{ userAgent: '*' }],
},
'branch-deploy': {
policy: [{ userAgent: '*', disallow: ['/'] }],
sitemap: null,
host: null,
},
'deploy-preview': {
policy: [{ userAgent: '*', disallow: ['/'] }],
sitemap: null,
host: null,
},
},
},
},
{
resolve: 'gatsby-plugin-styled-components',
options: {
displayName: NODE_ENV === 'development',
},
},
{ resolve: 'gatsby-plugin-sitemap' },
{ resolve: 'gatsby-plugin-react-helmet' },
{
resolve: 'gatsby-plugin-netlify',
options: {
mergeSecurityHeaders: false,
headers: {
'/*': [
'X-Frame-Options: DENY',
'X-XSS-Protection: 1; mode=block',
'X-Content-Type-Options: nosniff',
'Referrer-Policy: strict-origin-when-cross-origin',
],
},
},
}, // keep last
],
};