forked from paritytech/substrate-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
249 lines (236 loc) · 6.83 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/* read the `.env.*` files, gatsby builtin */
require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`,
});
const siteMetadata = require('./config/siteMetadata');
module.exports = {
siteMetadata,
plugins: [
'gatsby-plugin-substrate',
/* Custom ESLint to your Gatsby dev environment */
{
resolve: 'gatsby-plugin-eslint',
options: {
stages: ['develop'],
options: {
emitWarning: true,
failOnError: true,
},
},
},
'gatsby-plugin-postcss',
/* use tailwindcss, used sass instead of css */
{
resolve: 'gatsby-plugin-sass',
options: {
postCssPlugins: [
require('tailwindcss'),
/* Load custom Tailwind CSS configuration, used to purge
"unused" tailwind classes */
require('./tailwind.config.js'),
],
},
},
/* removing registered legacy worker from gatsby-plugin-offline */
'gatsby-plugin-remove-serviceworker',
/* add seo headers and page titles, from pages/components */
'gatsby-plugin-react-helmet',
/* generate an application manifest.json */
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `Substrate.io`,
short_name: `substrate.io`,
start_url: `/`,
background_color: `#24CC85`,
theme_color: `#24CC85`,
display: `minimal-ui`,
/* icon path is relative to the root of the site. */
icon: `media/favicon/favicon.png`,
},
},
/* source file system for (code based) icon images (svg) */
{
resolve: `gatsby-source-filesystem`,
options: {
name: `icons`,
path: `${__dirname}/src/images`,
},
},
{
resolve: 'gatsby-plugin-react-svg',
options: {
rule: {
include: `${__dirname}/src/images/svgs/`,
},
},
},
/* source file system for (cms) images/media/upload dir */
{
resolve: `gatsby-source-filesystem`,
options: {
name: `media`,
path: `${__dirname}/media`,
},
},
/* work with images
- need to be after sourcing images
- docs: https://www.gatsbyjs.com/plugins/gatsby-plugin-image */
`gatsby-plugin-image`,
/* transform and get data from images */
`gatsby-plugin-sharp`,
/* querying for images used in dynamic components */
`gatsby-transformer-sharp`,
/* Adds svg-react-loader to gatsby webpack config */
{
resolve: 'gatsby-plugin-react-svg',
options: {
rule: {
include: `${__dirname}/src/images/svg/`,
},
},
},
/* allow to use relative path for images in markdown and frontmatter;
used to work with netlify-cms, loaded after the media themselves */
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
// relative path for images in markdown content
{
resolve: `gatsby-remark-relative-images`,
options: {
staticFolderName: `${__dirname}`, // `/media/` already in img.src
include: ['featured_image', 'blockquote_author_avatar', 'incubators', 'accelerators', 'markdownremark'],
},
},
// gatsby-remark-relative-images must go before gatsby-remark-images
{
resolve: `gatsby-remark-images`,
options: { maxWidth: 1024 },
},
// links from markdown open in new tab by default
{
resolve: `gatsby-remark-external-links`,
},
// add IDs to headings generated from markdown
{
resolve: `gatsby-remark-autolink-headers`,
options: {
icon: false,
elements: [`h2`, `h3`],
},
},
],
},
},
/* source file system for content dir */
{
resolve: `gatsby-source-filesystem`,
options: {
name: `content`,
path: `./content/`,
},
},
/* source the locales for gatsby-react-i18next */
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/locales`,
name: `locale`,
},
},
{
resolve: `gatsby-plugin-react-i18next`,
options: {
localeJsonSourceName: `locale`, // name given to `gatsby-source-filesystem` plugin.
languages: [`en`],
defaultLanguage: `en`,
// if you are using Helmet, you must include siteUrl
siteUrl: `https://example.com/`,
// you can pass any i18next options
// pass following options to allow message content as a key
i18nextOptions: {
fallbackLng: 'en',
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},
keySeparator: false,
nsSeparator: false,
},
},
},
{
resolve: `gatsby-plugin-netlify-cms`,
options: {
/* call the js file, instead of yaml */
manualInit: true,
/* Netlify CMS customization code directory. */
modulePath: `${__dirname}/src/cms/index.js`,
/* use netlify-identity widget to login */
enableIdentityWidget: true,
},
},
{
resolve: `gatsby-plugin-breadcrumb`,
options: {
// useAutoGen: required 'true' to use autogen
useAutoGen: true,
// autoGenHomeLabel: optional 'Home' is default
autoGenHomeLabel: `Home`,
// exclude: optional, include this array to exclude paths you don't want to
// generate breadcrumbs for (see below for details).
exclude: [
`**/dev-404-page/**`,
`**/404/**`,
`**/404.html`,
`**/offline-plugin-app-shell-fallback/**`,
`**/ecosystem/`,
],
// crumbLabelUpdates: optional, update specific crumbLabels in the path
crumbLabelUpdates: [
{
pathname: '/ecosystem',
crumbLabel: 'Ecosystem',
},
{
pathname: '/ecosystem/projects',
crumbLabel: 'Projects',
},
{
pathname: '/ecosystem/opportunities',
crumbLabel: 'Opportunities',
},
{
pathname: '/ecosystem/resources',
crumbLabel: 'Resources',
},
{
pathname: '/ecosystem/connect',
crumbLabel: 'Connect',
},
{
pathname: '/ecosystem/square-one',
crumbLabel: 'Square One',
},
],
},
},
'gatsby-plugin-sitemap',
{
resolve: 'gatsby-plugin-simple-analytics',
options: {
domain: 'apisa.substrate.io',
eventsGlobal: 'sa',
events: true,
trackPageViews: true,
},
},
{
resolve: `gatsby-plugin-force-trailing-slashes`,
options: {
excludedPaths: [`/404.html`],
},
},
],
};