forked from MetaMask/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
178 lines (170 loc) · 5.2 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
const activeEnv =
process.env.ACTIVE_ENV || process.env.NODE_ENV || 'development'
const envConfig = {
path: `${__dirname}/gatsby.${activeEnv}.env`,
}
const env = require('dotenv').config(envConfig)
console.log('------- CURRENT ENVIRONMENT:', activeEnv.toUpperCase(), '-------')
const { getNewsUrl } = require(`./src/lib/utils/news`);
const low = require('lowlight')
const { definer: solidityLangDef } = require('highlightjs-solidity')
low.registerLanguage('solidity', solidityLangDef)
if (env.errors) {
// handle errors
} else {
module.exports = {
siteMetadata: {
title: 'MetaMask',
description: `MetaMask is a ConsenSys Formation.`,
siteUrl:
activeEnv === 'development'
? 'https://metamask.younetco.com'
: 'https://metamask.io',
},
plugins: [
{
resolve: 'gatsby-plugin-google-tagmanager',
options: {
id: process.env.GATSBY_GTM_ID,
// Defaults to false meaning GTM will only be loaded in production.
includeInDevelopment: false,
// Defaults to false
enableWebVitalsTracking: true,
},
},
{
resolve: `gatsby-plugin-google-analytics`,
options: {
// The property ID; the tracking code won't be generated without it
trackingId: process.env.GATSBY_GA_ID,
// Defines where to place the tracking script - `true` in the head and `false` in the body
head: true,
// Setting this parameter is optional
anonymize: true,
// Avoids sending pageview hits from custom paths
exclude: ['/preview/**'],
},
},
`gatsby-plugin-sass`,
'gatsby-plugin-react-helmet',
'gatsby-plugin-sharp',
`gatsby-plugin-styled-components`,
'gatsby-transformer-sharp',
'gatsby-transformer-remark',
'gatsby-plugin-root-import',
'gatsby-transformer-inline-svg',
'gatsby-plugin-meta-redirect',
{
resolve: `gatsby-source-contentful`,
options: {
spaceId: process.env.GATSBY_CONTENTFUL_SPACE_ID,
accessToken: process.env.GATSBY_CONTENTFUL_API_KEY,
environment: process.env.GATSBY_CONTENTFUL_ENVIRONMENT,
downloadLocal: process.env.GATSBY_CONTENTFUL_DOWNLOAD_LOCAL,
host: process.env.GATSBY_CONTENTFUL_HOST,
localeFilter: locale => locale.code === 'en-US'
},
},
{
resolve: `gatsby-plugin-manifest`,
options: {
icon: `${__dirname}/src/images/metamask-logo.png`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
{
resolve: 'gatsby-plugin-react-svg',
options: {
rule: {
include: `${__dirname}/src/images`,
},
},
},
{
resolve: `gatsby-plugin-sitemap`,
options: {
query: `
{
site {
siteMetadata {
siteUrl
}
}
allSitePage {
edges {
node {
path
}
}
}
allContentfulLayout(filter: {isPrivate: {eq: true}}) {
edges {
node {
slug
}
}
}
allContentfulNews(filter: {isPrivate: {eq: true}}) {
edges {
node {
title
categories {
name
}
}
}
}
}`,
serialize: ({ site, allSitePage, allContentfulLayout, allContentfulNews }) => {
let privatePages = ['/preview/']
allContentfulLayout.edges.map(edge => {
privatePages.push(edge.node.slug)
})
allContentfulNews.edges.map((edge) => {
const newsUrl = getNewsUrl(edge.node);
privatePages.push(newsUrl);
});
let pages = []
const siteUrl =
activeEnv === 'development'
? 'https://metamask.younetco.com'
: site.siteMetadata.siteUrl
allSitePage.edges.map(edge => {
if (privatePages.indexOf(edge.node.path) === -1) {
pages.push({
url: siteUrl + edge.node.path,
changefreq: `daily`,
priority: edge.node.path === '' ? 1 : 0.8,
})
}
})
return pages
},
},
},
'gatsby-plugin-well-known',
'gatsby-plugin-preact',
{
resolve: 'gatsby-plugin-robots-txt',
options:
activeEnv === 'production'
? {
host: 'https://metamask.io',
sitemap: 'https://metamask.io/sitemap.xml',
policy: [{ userAgent: '*', allow: '/' }],
}
: {
host: 'https://metamask.younetco.com',
sitemap: 'https://metamask.younetco.com/sitemap.xml',
policy: [{ userAgent: '*', disallow: '/' }],
},
},
],
}
}