forked from uakbr/ethereum-org-website
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gatsby-config.js
228 lines (226 loc) · 6.28 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
const translations = require("./src/utils/translations")
require("dotenv").config()
const supportedLanguages = translations.supportedLanguages
const defaultLanguage = `en`
const siteUrl = `https://ethereum.org`
module.exports = {
siteMetadata: {
// `title` & `description` pulls from respective ${lang}.json files in PageMetadata.js
title: `ethereum.org`,
description: `Ethereum is a global, decentralized platform for money and new kinds of applications. On Ethereum, you can write code that controls money, and build applications accessible anywhere in the world.`,
url: siteUrl,
siteUrl,
author: `@ethereum`,
defaultLanguage,
supportedLanguages,
editContentUrl: `https://github.com/ethereum/ethereum-org-website/tree/dev/`,
},
plugins: [
// i18n support
{
resolve: `gatsby-plugin-intl`,
options: {
// language JSON resource path
path: `${__dirname}/src/intl`,
// supported language
languages: supportedLanguages,
// language file path
defaultLanguage,
// redirect to `/${lang}/` when connecting to `/`
// based on user's browser language preference
redirect: true,
},
},
// Web app manifest
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `ethereum.org`,
short_name: `ethereum.org`,
start_url: `/en/`,
background_color: `#fff`,
theme_color: `#1c1ce1`,
display: `standalone`,
icon: `src/assets/favicon.png`,
},
},
// Matomo analtyics
{
resolve: "gatsby-plugin-matomo",
options: {
siteId: "4",
matomoUrl: "https://matomo.ethereum.org",
siteUrl,
matomoPhpScript: "matomo.php",
matomoJsScript: "matomo.js",
trackLoad: false,
// dev: true,
},
},
{
resolve: `gatsby-plugin-lodash`,
options: {
disabledFeatures: [
`shorthands`,
`currying`,
`caching`,
`collections`,
`exotics`,
`guards`,
`metadata`,
`deburring`,
`unicode`,
`chaining`,
`momoizing`,
`coercions`,
`flattening`,
`paths`,
`placeholders`,
],
},
},
// Sitemap generator (ethereum.org/sitemap.xml)
{
resolve: `gatsby-plugin-sitemap`,
options: {
query: `{
site {
siteMetadata {
siteUrl
}
}
allSitePage {
nodes {
path
}
}
}`,
serialize: ({ site, allSitePage }) =>
allSitePage.nodes
.filter((node) => {
// Filter out 404 pages
return !node.path.includes("404")
})
.map((node) => {
const path = node.path
const url = `${site.siteMetadata.siteUrl}${path}`
const changefreq = path.includes(`/${defaultLanguage}/`)
? `weekly`
: `monthly`
const priority = path.includes(`/${defaultLanguage}/`) ? 0.7 : 0.5
return {
url,
changefreq,
priority,
}
}),
},
},
// Ability to set custom IDs for headings (for translations)
// i.e. https://www.markdownguide.org/extended-syntax/#heading-ids
`gatsby-remark-autolink-headers`,
// Image support in markdown
`gatsby-remark-images`,
`gatsby-remark-copy-linked-files`,
// MDX support
{
resolve: `gatsby-plugin-mdx`,
options: {
// process all `.md` files as MDX
extensions: [`.mdx`, `.md`],
// Workaround to fix `backgroundColor` bug:
// https://github.com/gatsbyjs/gatsby/issues/25272
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
backgroundColor: `transparent`,
maxWidth: 1200,
},
},
],
// Note: in order for MDX to work with gatsby-remark-plugins
// The plugin must be listed top-level & in gatsbyRemarkPlugins
// See: https://www.gatsbyjs.org/docs/mdx/plugins/
gatsbyRemarkPlugins: [
{
resolve: `gatsby-remark-autolink-headers`,
options: {
enableCustomId: true,
elements: [`h1`, `h2`, `h3`, `h4`],
className: `header-anchor`,
},
},
{
resolve: `gatsby-remark-images`,
options: {
backgroundColor: `transparent`,
maxWidth: 1200,
},
},
{
resolve: `gatsby-remark-copy-linked-files`,
options: {
maxWidth: 1200,
},
},
],
remarkPlugins: [],
},
},
// SEO tags
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-plugin-react-helmet-canonical-urls`,
options: {
siteUrl,
noQueryString: true,
},
},
// Needed for `gatsby-image`
`gatsby-plugin-sharp`,
// CSS in JS
`gatsby-plugin-styled-components`,
// Source assets
{
resolve: `gatsby-source-filesystem`,
options: {
name: `assets`,
path: `${__dirname}/src/assets`,
},
},
// Process files from /src/content/ (used in gatsby-node.js)
{
resolve: `gatsby-source-filesystem`,
options: {
name: `content`,
path: `${__dirname}/src/content`,
},
},
// Source data
{
resolve: `gatsby-source-filesystem`,
options: {
name: `data`,
path: `${__dirname}/src/data`,
},
},
// Process files within /src/data/
`gatsby-transformer-csv`,
// Add git information on File fields from latest commit: date, author and email
// Used for `Last updated` fields
{
resolve: `gatsby-transformer-gitinfo`,
options: {
include: /\.md$|\.csv/i, // Only .md & .csv files
},
},
// Needed for `gatsby-image`
`gatsby-transformer-sharp`,
],
// https://www.gatsbyjs.com/docs/reference/release-notes/v2.28/#feature-flags-in-gatsby-configjs
flags: {
PRESERVE_WEBPACK_CACHE: true,
FAST_DEV: true, // DEV_SSR, QUERY_ON_DEMAND & LAZY_IMAGES
},
}