forked from ethereum/ethereum-org-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
216 lines (213 loc) · 5.8 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
const translations = require("./src/utils/translations")
require("dotenv").config()
const supportedLanguages = translations.supportedLanguages
const defaultLanguage = `en`
const siteUrl = `https://ethereum.org`
const READ_ONLY_GITHUB_TOKEN = `b809cbd0bd021c349291f0425871ea981a2e290f`
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 `/en/` when connecting `/`
redirect: false,
},
},
// 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`,
// MDX support
{
resolve: `gatsby-plugin-mdx`,
options: {
// process all `.md` files as MDX
extensions: [`.mdx`, `.md`],
// 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: {
maxWidth: 1200,
},
},
],
remarkPlugins: [],
},
},
// SEO tags
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-plugin-react-helmet-canonical-urls`,
options: {
siteUrl,
},
},
// 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`,
},
},
// Source GitHub API
{
resolve: `gatsby-source-graphql`,
options: {
typeName: `GitHub`,
fieldName: `github`,
url: `https://api.github.com/graphql`,
headers: {
Authorization: `Bearer ${READ_ONLY_GITHUB_TOKEN}`,
},
},
},
// 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`,
],
}