-
Notifications
You must be signed in to change notification settings - Fork 1
/
gatsby-config.ts
163 lines (155 loc) · 4.18 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
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
/// <reference lib='es2019.array' />
import dotenv from 'dotenv';
import type { GatsbyConfig } from 'gatsby';
dotenv.config({
path: `.env.${process.env.NODE_ENV as string}`,
});
const isDevelopment = process.env.NODE_ENV === 'development';
const metadata = {
name: `Junyoung/"Clare" Jang`,
shortName: `J. Jang`,
description: `Ailrun's Blog`,
themeColor: `#000000`,
siteUrl: `https://Ailrun.github.io`,
};
const graphqlTypegen = isDevelopment;
const config: GatsbyConfig = {
siteMetadata: {
name: metadata.name,
shortName: metadata.shortName,
siteUrl: metadata.siteUrl,
description: metadata.description,
author: `Junyoung/"Clare" Jang (@Ailrun)`,
locales: [
`ko_KR`,
],
themeColor: metadata.themeColor,
titleTemplate: `%s - ${metadata.shortName}`,
},
plugins: [
`gatsby-plugin-custom-eslint`,
`gatsby-plugin-typescript`,
...(graphqlTypegen ? [] : [`gatsby-plugin-custom-ts-checker`]),
{
resolve: `gatsby-source-filesystem`,
options: {
path: `./post/`,
name: `MarkdownPost`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `./post-draft/`,
name: `MarkdownPost`,
},
},
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-autolink-headers`,
options: {
enableCustomId: true,
isIconAfterHeader: true,
},
},
{
resolve: `gatsby-remark-katex`,
options: {
strict: `error`,
},
},
],
},
},
`gatsby-plugin-catch-links`,
`gatsby-plugin-preload-fonts`,
`gatsby-plugin-react-helmet-async`,
`gatsby-plugin-emotion`,
`gatsby-plugin-sitemap`,
{
resolve: `gatsby-plugin-robots-txt`,
options: {
policy: [
{
userAgent: `*`,
disallow: [
`/iframe/`,
`/${process.env.GATSBY_DRAFT_PATH as string}/`,
],
},
],
},
},
/**
* Add localization after language switch is enabled.
*/
{
resolve: `gatsby-plugin-manifest`,
options: {
name: metadata.name,
short_name: metadata.shortName,
description: metadata.description,
start_url: `/ko/posts/index.html`,
scope: `/ko/`,
background_color: metadata.themeColor,
theme_color: metadata.themeColor,
display: `standalone`,
icon: `src/assets/icon.png`,
crossOrigin: `use-credentials`,
},
},
{
resolve: `gatsby-plugin-offline`,
options: {
precachePages: [
`ko`,
`en`,
]
.map((language) => [
`/${language}/*`,
])
.flat()
.concat([
`/`,
]),
},
},
{
resolve: `gatsby-plugin-google-gtag`,
options: {
trackingIds: [
`UA-159365767-1`,
],
pluginConfig: {
head: true,
exclude: [
`/iframe/**`,
`/${process.env.GATSBY_DRAFT_PATH as string}/**`,
],
},
},
},
{
resolve: `gatsby-plugin-csp`,
options: {
disableOnDev: false,
mergeDefaultDirectives: false,
mergeScriptHashes: false,
mergeStyleHashes: false,
directives: {
'default-src': `'self' https://disqus.com https://*.disqus.com https://*.disquscdn.com https://www.google-analytics.com https://fonts.gstatic.com https://www.googletagmanager.com https://stats.g.doubleclick.net`,
'font-src': `'self' https://c.disquscdn.com https://fonts.gstatic.com`,
'img-src': `'self' https:`,
'script-src': `'self' https://disqus.com https://*.disqus.com/ https://*.disquscdn.com https://www.google-analytics.com https://www.googletagmanager.com 'unsafe-inline'`,
'style-src': `'self' https://fonts.googleapis.com https://disqus.com https://*.disqus.com https://*.disquscdn.com blob: 'unsafe-inline'`
},
},
},
],
trailingSlash: 'always',
graphqlTypegen,
};
export default config;