-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
267 lines (260 loc) · 7.73 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
255
256
257
258
259
260
261
262
263
264
265
266
267
const generateSlug = require('./src/gatsby/node/generateSlug')
/* eslint-disable no-param-reassign */
const name = 'Himalay Sunuwar'
const siteMetadata = {
name,
bio: "I'm a programmer from Himalayas, I listen to Metal and eat Rice. No I don't smoke, drink, or do drugs.",
title: `${name} - Full-stack Developer, Software Architect`,
description:
'A full-stack developer with 5+ years of experience in architecting and building scalable systems for web applications.',
siteUrl: 'https://himalay.com.np',
pathPrefix: '',
social: {
github: 'himalay',
linkedin: 'sunuwar',
twitter: 'HimalaySunuwar',
instagram: 'HimalaySunuwar',
email: 'contact@himalay.com.np',
},
}
module.exports = {
siteMetadata,
plugins: [
'gatsby-plugin-typescript',
'gatsby-image',
'gatsby-plugin-react-helmet',
'gatsby-plugin-sharp',
'gatsby-transformer-sharp',
'gatsby-transformer-remark',
'gatsby-plugin-theme-ui',
'gatsby-plugin-sitemap',
'gatsby-transformer-json',
'gatsby-plugin-offline',
{
resolve: 'gatsby-plugin-manifest',
options: {
/* eslint-disable @typescript-eslint/camelcase */
name,
short_name: name.split(' ')[0],
start_url: '/',
background_color: '#002b36',
theme_color: '#002b36',
display: 'standalone',
icon: 'src/assets/himalay_logo.png',
},
},
{
resolve: 'gatsby-plugin-google-analytics',
options: {
trackingId: 'UA-9444470-1',
},
},
{
resolve: 'gatsby-plugin-feed',
options: {
query: `
{
site {
siteMetadata {
title
description
siteUrl
site_url: siteUrl
}
}
}
`,
setup: ({ query, ...rest }) => {
const { siteUrl } = query.site.siteMetadata
query.site.siteMetadata.feed_url = `${siteUrl}/rss.xml`
query.site.siteMetadata.image_url = `${siteUrl}/icons/icon-512x512.png`
const siteMetadataModified = query.site.siteMetadata
siteMetadataModified.feed_url = `${siteUrl}/rss.xml`
siteMetadataModified.image_url = `${siteUrl}/icons/icon-512x512.png`
return {
...siteMetadataModified,
...rest,
}
},
feeds: [
{
serialize: ({ query: { allMdx } }) => {
return allMdx.edges.map((edge) => {
const { frontmatter, html } = edge.node
const basePath = '/'
const slug = generateSlug(basePath, frontmatter.slug || frontmatter.title, frontmatter.date)
return {
title: frontmatter.title,
date: frontmatter.date,
description: frontmatter.excerpt,
url: siteMetadata.siteUrl + slug,
guid: siteMetadata.siteUrl + slug,
enclosure: {
url: siteMetadata.siteUrl + (frontmatter.hero.publicURL || '/icons/icon-512x512.png'),
},
custom_elements: [{ 'content:encoded': html }],
}
})
},
query: `
{
allMdx(sort: {order: DESC, fields: frontmatter___date}) {
edges {
node {
html
frontmatter {
title
excerpt
date
hero {
publicURL
}
}
}
}
}
}
`,
output: '/rss.xml',
title: `${siteMetadata.title} RSS Feed`,
description: `${siteMetadata.description}`,
},
],
},
},
{
resolve: 'gatsby-plugin-local-search',
options: {
name: 'pages',
engine: 'flexsearch',
// GraphQL query used to fetch all data for the search index.
query: `
{
allArticle(
sort: { fields: [date, title], order: DESC }
limit: 1000
) {
edges {
node {
id
slug
title
excerpt
date(formatString: "MMMM Do, YYYY")
}
}
}
}
`,
// List of keys to index. The values of the keys are taken from the
// normalizer function below.
// Default: all fields
index: ['title', 'excerpt'],
// List of keys to store and make available in your UI. The values of
// the keys are taken from the normalizer function below.
store: ['id', 'title', 'slug', 'excerpt', 'date'],
// 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.
normalizer: ({ data }) => data.allArticle.edges.map(({ node }) => node),
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: 'content/posts',
name: 'content/posts',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: '_data/comments/',
name: 'data/comments',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: '_data/hearts/',
name: 'data/hearts',
},
},
{
resolve: 'gatsby-plugin-mdx',
options: {
extensions: ['.mdx', '.md'],
gatsbyRemarkPlugins: [
{
resolve: 'gatsby-remark-images',
options: {
maxWidth: 10000,
linkImagesToOriginal: false,
quality: 80,
withWebp: true,
},
},
{
resolve: '@raae/gatsby-remark-oembed',
options: {
providers: {
include: ['Instagram'],
},
},
},
{
resolve: 'gatsby-remark-embed-video',
options: {
width: 680,
ratio: 1.77, // Optional: Defaults to 16/9 = 1.77
height: 400, // Optional: Overrides optional.ratio
related: false, // Optional: Will remove related videos from the end of an embedded YouTube video.
noIframeBorder: true, // Optional: Disable insertion of <style> border: 0
urlOverrides: [
{
id: 'youtube',
embedURL: (videoId) => `https://www.youtube-nocookie.com/embed/${videoId}`,
},
], // Optional: Override URL of a service provider, e.g to enable youtube-nocookie support
},
},
{ resolve: 'gatsby-remark-copy-linked-files' },
{ resolve: 'gatsby-remark-numbered-footnotes' },
{ resolve: 'gatsby-remark-smartypants' },
{
resolve: 'gatsby-remark-external-links',
options: {
target: '_blank',
rel: 'noreferrer',
},
},
],
remarkPlugins: [require('remark-slug')], // eslint-disable-line global-require
},
},
{
resolve: 'gatsby-plugin-emotion',
options: {
displayName: process.env.NODE_ENV === 'development',
},
},
{
resolve: 'gatsby-plugin-canonical-urls',
options: {
siteUrl: siteMetadata.siteUrl,
},
},
{
resolve: 'gatsby-plugin-eslint',
options: {
test: /\.jsx?$|\.tsx?$/,
exclude: /(node_modules|.cache|public)/,
stages: ['develop'],
options: {
emitWarning: true,
failOnError: false,
},
},
},
],
}