-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
154 lines (141 loc) · 4.09 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`
});
const {
NODE_ENV,
URL: NETLIFY_SITE_URL = "https://yourdoman.com",
DEPLOY_PRIME_URL: NETLIFY_DEPLOY_URL = NETLIFY_SITE_URL,
CONTEXT: NETLIFY_ENV = NODE_ENV
} = process.env;
const isNetlifyProduction = NETLIFY_ENV === "production";
const siteUrl = isNetlifyProduction ? NETLIFY_SITE_URL : NETLIFY_DEPLOY_URL;
const path = require("path");
module.exports = themeOptions => {
const {
siteUrl,
title,
description,
author,
image
} = themeOptions.siteMetadata;
const datacms = themeOptions.datocms || {};
datacms.apiToken = datacms.apiToken || "";
datacms.previewMode = datacms.previewMode || false;
return {
siteMetadata: {
siteUrl: siteUrl || "",
title: title || "",
description: description || "",
author: author || "",
image: image || ""
},
plugins: [
// "gatsby-transformer-react-docgen",
"gatsby-plugin-styled-components",
{
resolve: `gatsby-source-filesystem`,
options: {
name: `data`,
path: `${__dirname}/src/Images/`,
ignore: [`**/\.*`] // ignore files starting with a dot
}
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `components`,
path: `${__dirname}/src/components/`,
ignore: [`**/\.*`] // ignore files starting with a dot
}
},
// "gatsby-plugin-sitemap" - disabled due to bug preventing createPagesStatefully,
"gatsby-transformer-sharp",
{
resolve: `gatsby-source-datocms`,
options: {
// You can find your read-only API token under the Settings > API tokens
// section of your administrative area:
apiToken: datacms.apiToken,
// If you are working on development/staging environment, you might want to
// preview the latest version of records instead of the published one:
previewMode: datacms.previewMode,
// Disable automatic reloading of content when some change occurs on DatoCMS:
disableLiveReload: false,
// Custom API base URL
apiUrl: "https://site-api.datocms.com",
// Setup locale fallbacks
// In this example, if some field value is missing in Italian, fall back to English
localeFallbacks: {
it: ["en"]
}
}
},
{
resolve: "gatsby-plugin-robots-txt",
options: {
resolveEnv: () => NETLIFY_ENV,
env: {
production: {
sitemap: `${siteUrl}/sitemap.xml`,
policy: [{ userAgent: "*" }]
},
"branch-deploy": {
policy: [{ userAgent: "*", disallow: ["/"] }],
sitemap: null,
host: null
},
"deploy-preview": {
policy: [{ userAgent: "*", disallow: ["/"] }],
sitemap: null,
host: null
}
}
}
},
{
resolve: `gatsby-plugin-sitemap`,
options: {
exclude: [
`/about/privacy-policy/`,
"/about/cookie-policy/",
"/about/terms-and-conditions/",
"/docs/",
"/docs/*"
]
}
},
"gatsby-plugin-sharp",
{
resolve: `gatsby-plugin-manifest`,
options: {
name: title,
short_name: `C21Finance`,
start_url: `/`,
background_color: `#f7f0eb`,
theme_color: `#BEA`,
display: `standalone`
// icon: `${__dirname}/src/Images/icon.png`
}
},
{
resolve: "gatsby-plugin-page-creator",
options: {
path: path.join(__dirname, "src", "pages")
}
},
{
resolve: "gatsby-plugin-compile-es6-packages",
options: {
// replace with the name of your theme
modules: ["gatsby-theme-datocms"]
}
},
{
resolve: "gatsby-plugin-react-helmet-canonical-urls",
options: {
siteUrl
}
}
]
};
};