-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.ts
111 lines (103 loc) · 2.44 KB
/
gatsby-config.ts
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
/*
Gatsby configuration file
-------------------------
*/
import type { GatsbyConfig } from 'gatsby';
import { MetadataInterface } from './src/common/types';
const ConfigManager = require('./config-manager');
const configManager = new ConfigManager();
const metadata = configManager.getMetadata();
const lightTheme = configManager.getTheme('light');
const darkTheme = configManager.getTheme('dark');
const config: GatsbyConfig = {
siteMetadata: {
...metadata as MetadataInterface,
lightTheme,
darkTheme
},
plugins: [
'gatsby-plugin-react-helmet',
'gatsby-plugin-postcss',
{
resolve: 'gatsby-plugin-sitemap',
options: {
// Generate sitemaps at the root of the site
output: '/',
serialize: ({ path }: { path: string }) => {
return {
url: path,
// Because this is a single page site, we can assume the page is modified on every build
// Remove this if more pages are added so Google doesn't get upset
lastmod: Date.now(),
changefreq: 'monthly'
}
},
}
},
{
resolve: 'gatsby-plugin-robots-txt',
options: {
// Link to the sitemap index generated above
sitemap: `${metadata.siteUrl}/sitemap-index.xml`,
policy: [
{
userAgent: '*',
allow: '/'
}
]
}
},
{
resolve: 'gatsby-plugin-google-gtag',
options: {
trackingIds: [
metadata.trackingId
],
gtagConfig: {
// Opt-out of personalized advertising features
anonymize_ip: true,
allow_google_signals: false,
allow_ad_personalization_signals: false
},
pluginConfig: {
head: true
}
}
},
{
resolve: 'gatsby-plugin-image-generator',
options: {
generate: [
configManager.getOgImage(),
...configManager.getIcons()
]
}
},
{
resolve: 'gatsby-plugin-manifest',
options: {
name: metadata.title,
short_name: metadata.shortTitle,
start_url: '/',
background_color: darkTheme['base-100'],
theme_color: darkTheme['primary'],
display: 'standalone',
icons: configManager.getIconManifestEntries(),
// Favicon declarations and theme color meta tags are added to the document head manually using React Helmet
include_favicon: false,
theme_color_in_head: false
}
},
// This plugin need to be listed after gatsby-plugin-manifest
'gatsby-plugin-offline',
{
resolve: 'gatsby-plugin-react-svg',
options: {
rule: {
include: /\.svg$/
}
}
}
]
};
export default config;