-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
254 lines (242 loc) · 6.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
module.exports = {
siteMetadata: {
// edit below
title: `Dan Goslen | Team-Driven Developer`,
author: `Dan Goslen`,
description: `Blog and website of software engineer Dan Goslen`,
siteUrl: `https://dangoslen.me`,
social: {
twitter: `@dangoslen`,
linkedin: `dangoslen`,
devto: `dangoslen`
},
defaultImage: `content/assets/icon.png`
},
plugins: [
`gatsby-plugin-netlify-cms`,
`gatsby-plugin-styled-components`,
`gatsby-plugin-image`,
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
`gatsby-plugin-offline`,
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/content/blog`,
name: `blog`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/content/assets`,
name: `assets`,
},
},
{
resolve: `gatsby-plugin-mdx`,
options: {
extensions: [".mdx", ".md"],
gatsbyRemarkPlugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 800,
},
},
{
resolve: `gatsby-remark-responsive-iframe`,
options: {
wrapperStyle: `margin-bottom: 1.0725rem`,
},
},
{
resolve: `gatsby-remark-vscode`,
},
{
resolve: `gatsby-remark-copy-linked-files`,
},
{
resolve: `gatsby-remark-smartypants`,
}],
},
},
{
resolve: `gatsby-plugin-splitbee`,
options: {
includeInDevelopment: false,
delayTimeout: 0
},
},
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `Dan Goslen`,
short_name: `dangoslen`,
start_url: `/`,
background_color: `#f4f4f4`,
theme_color: `#fd863f`,
display: `minimal-ui`,
// edit below
icon: `content/assets/icon.png`,
},
},
{
resolve: `gatsby-plugin-typography`,
options: {
pathToConfigModule: `src/utils/typography`,
},
},
{
resolve: `gatsby-plugin-canonical-urls`,
options: {
siteUrl: `https://dangoslen.me`,
},
},
{
resolve: `gatsby-plugin-google-gtag`,
options: {
trackingIds: [
"G-XZ4B4FVPLX",
],
// This object gets passed directly to the gtag config command
// This config will be shared across all trackingIds
gtagConfig: {
anonymize_ip: true,
cookie_expires: 0,
},
}
},
{
resolve: "gatsby-plugin-sitemap",
options: {
query: `
{
site {
siteMetadata {
siteUrl
}
}
allMdx(sort: {fields: frontmatter___date, order: DESC}, filter: {slug: {glob: "!*wip*"}}) {
nodes {
slug
frontmatter {
date(formatString: "YYYY-MM-DD")
}
}
}
}
`,
resolveSiteUrl: ({ site: { siteMetadata: { siteUrl } } }) => siteUrl,
resolvePages: ({ allMdx: { nodes: posts } }) => {
const entries = posts.map(post => {
return {
path: `/blog/${post.slug}/`,
lastmod: post.frontmatter.date,
changefreq: 'weekly',
priority: 0.7,
}
})
const home = {
path: '/',
lastmod: posts[0].lastmod,
changefreq: 'daily',
priority: 0.3,
}
const blog = {
path: '/blog',
lastmod: posts[0].lastmod,
changefreq: 'daily',
priority: 0.3,
}
const book = {
path: '/book',
lastmod: posts[0].lastmod,
changefreq: 'monthly',
priority: 0.3,
}
const talks = {
path: '/talks',
lastmod: posts[0].lastmod,
changefreq: 'yearly',
priority: 0.3,
}
return [home, blog, book, talks, ...entries]
},
serialize: ({ path, lastmod, changefreq, priority }) => {
return {
url: path,
lastmod,
changefreq,
priority,
}
},
}
},
{
resolve: 'gatsby-plugin-local-search',
options: {
// A unique name for the search index. This should be descriptive of
// what the index contains. This is required.
name: 'posts',
// Set the search engine to create the index. This is required.
// The following engines are supported: flexsearch, lunr
engine: 'flexsearch',
// Provide options to the engine. This is optional and only recommended
// for advanced users.
//
// Note: Only the flexsearch engine supports options.
engineOptions: {
tokenize: 'forward'
},
// GraphQL query used to fetch all data for the search index. This is
// required.
query: `
{
posts: allMdx(sort: { fields: [frontmatter___date], order: DESC }) {
nodes {
id
fields {
slug
}
frontmatter {
date(formatString: "MMMM DD, YYYY")
title
description
tags
}
}
}
}
`,
// Field used as the reference value for each document.
// Default: 'id'.
ref: 'id',
// List of keys to index. The values of the keys are taken from the
// normalizer function below.
// Default: all fields
index: ['title', 'tags', 'description', 'body'],
// List of keys to store and make available in your UI. The values of
// the keys are taken from the normalizer function below.
// Default: all fields
store: ['id', 'slug', 'path', 'title', 'date', 'tags', 'description'],
// Function used to map the result from the GraphQL query. This should
// return an array of items to index in the form of flat objects
// containing properties to index. The objects must contain the `ref`
// field above (default: 'id'). This is required.
normalizer: ({ data }) =>
data.posts.nodes.map((node) => ({
id: node.id,
slug: node.fields.slug,
path: node.frontmatter.path,
title: node.frontmatter.title,
date: node.frontmatter.date,
tags: node.frontmatter.tags,
description: node.frontmatter.description,
body: node.rawMarkdownBody,
})),
},
},
],
}