forked from kremalicious/blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.ts
213 lines (208 loc) · 6.04 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
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
import type { GatsbyConfig } from 'gatsby'
import siteConfig from './config'
import sources from './gatsby/sources'
import { feedContent } from './gatsby/feeds'
// required for gatsby-plugin-meta-redirect
import 'regenerator-runtime/runtime'
//import algolia from './gatsby/algolia'
const config: GatsbyConfig = {
graphqlTypegen: {
typesOutputPath: './src/@types/Gatsby.d.ts',
generateOnBuild: true
},
siteMetadata: {
...siteConfig
},
plugins: [
...sources,
'gatsby-plugin-image',
{
resolve: 'gatsby-plugin-sharp',
options: {
stripMetadata: false,
defaults: {
quality: 85
}
}
},
'gatsby-transformer-sharp',
{
resolve: 'gatsby-transformer-remark',
options: {
excerpt_separator: '<!-- more -->',
plugins: [
'gatsby-remark-smartypants',
{
resolve: 'gatsby-remark-images',
options: {
maxWidth: 666,
quality: 80,
linkImagesToOriginal: false,
showCaptions: true,
backgroundColor: 'none',
disableBgImageOnAlpha: true
}
},
{
resolve: 'gatsby-remark-images-medium-zoom',
options: {
background: '#e7eef4'
}
},
{
resolve: 'gatsby-remark-copy-linked-files',
options: {
destinationDir: 'media'
}
},
{
resolve: 'gatsby-remark-autolink-headers',
options: {
icon: '<span>#</span>'
}
},
{
// https://github.com/andrewbranch/gatsby-remark-vscode
resolve: 'gatsby-remark-vscode',
options: {
theme: {
default: 'Polar',
parentSelector: { 'body.dark': 'Nord' }
},
injectStyles: false,
extensions: ['nord-visual-studio-code', 'polar'],
languageAliases: {}
}
}
]
}
},
{
resolve: 'gatsby-plugin-svgr',
options: {
icon: false,
svgoConfig: {
plugins: [{ name: 'removeViewBox', active: false }]
}
}
},
{
resolve: 'gatsby-plugin-lunr',
options: {
languages: [
{
// ISO 639-1 language codes. See https://lunrjs.com/guides/language_support.html for details
name: 'en'
}
],
// Fields to index. If store === true value will be stored in index file.
// Attributes for custom indexing logic. See https://lunrjs.com/docs/lunr.Builder.html for details
fields: [
{ name: 'title', attributes: { boost: 20 } },
{ name: 'tags', attributes: { boost: 15 } },
{ name: 'excerpt', attributes: { boost: 10 } },
{ name: 'slug', store: true },
{ name: 'content' }
],
// How to resolve each field's value for a supported node type
resolvers: {
// For any node of type MarkdownRemark, list how to resolve the fields' values
MarkdownRemark: {
title: (node) => node.frontmatter.title,
excerpt: (node) => node.excerpt,
tags: (node) => node.frontmatter.tags,
content: (node) => node.rawMarkdownBody,
slug: (node) => node.fields.slug
}
}
}
},
{
resolve: 'gatsby-plugin-manifest',
options: {
name: siteConfig.siteTitle,
start_url: '/',
background_color: siteConfig.backgroundColor,
theme_color: siteConfig.themeColor,
icon: 'src/images/apple-touch-icon.png',
display: 'standalone',
cache_busting_mode: 'name',
theme_color_in_head: false // dynamically set in ThemeSwitch
}
},
{
resolve: 'gatsby-plugin-feed',
options: {
query: `
{
site {
siteMetadata {
siteTitle
siteDescription
siteUrl
title: siteTitle
description: siteDescription
site_url: siteUrl
}
}
}
`,
feeds: [
{
serialize: ({ query }: { query: Queries.AllContentFeedQuery }) => {
return query.allMarkdownRemark.edges.map((edge) => {
return Object.assign({}, edge.node.frontmatter, {
title: edge.node.frontmatter?.title,
date: edge.node.fields?.date,
description: edge.node.excerpt,
url: siteConfig.siteUrl + edge.node.fields?.slug,
categories: edge.node.frontmatter?.tags,
author: siteConfig.author.name,
guid: siteConfig.siteUrl + edge.node.fields?.slug,
custom_elements: [{ 'content:encoded': feedContent(edge) }]
})
})
},
query: `{
allMarkdownRemark(sort: {fields: {date: DESC}}, limit: 40) {
edges {
node {
html
fields {
slug
date
}
excerpt
frontmatter {
title
image {
childImageSharp {
resize(width: 940, quality: 85) {
src
}
}
}
}
}
}
}
}`,
output: '/feed.xml',
title: siteConfig.siteTitle
}
]
}
},
{
resolve: 'gatsby-plugin-sitemap',
options: {
excludes: ['/archive', '/archive/**/*', '/thanks', '/tags']
}
},
'gatsby-plugin-catch-links',
'gatsby-redirect-from',
'gatsby-plugin-meta-redirect'
// { ...algolia }
]
}
export default config