This repository was archived by the owner on May 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgatsby-config.js
More file actions
248 lines (245 loc) · 7.42 KB
/
Copy pathgatsby-config.js
File metadata and controls
248 lines (245 loc) · 7.42 KB
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
/* eslint-disable @typescript-eslint/no-var-requires */
const {
NODE_ENV,
URL: NETLIFY_SITE_URL = 'https://soyuj.com.np',
DEPLOY_PRIME_URL: NETLIFY_DEPLOY_URL = NETLIFY_SITE_URL,
CONTEXT: NETLIFY_ENV = NODE_ENV,
} = process.env;
const isNetlifyProduction = NETLIFY_ENV === 'production';
const siteUrl = isNetlifyProduction ? NETLIFY_SITE_URL : NETLIFY_DEPLOY_URL;
const path = require('path');
function filterHTML(str, url) {
let noIframe = str.replace(/<iframe.*?<\/iframe>/g, '').replace(/src="(\/.*?)"/g, `src="${url}$1"`);
return noIframe.replace(/<span class="gatsby-resp-image-background-image".*?><\/span>\s/g, '');
}
module.exports = {
siteMetadata: {
title: 'Soyuj Jung Basnet',
description:
'Personal portfolio and blogging website of Soyuj Jung Basnet. A collection of my thoughts, musings, experiences, tutorials, snippets, articles, and everything else.',
siteUrl: 'https://soyuj.com.np',
},
mapping: {
'MarkdownRemark.frontmatter.author': 'AuthorYaml',
},
plugins: [
`gatsby-plugin-remove-trailing-slashes`,
{
resolve: `gatsby-plugin-sitemap`,
options: {
exclude: ['/thank-you'],
},
},
{
resolve: 'gatsby-plugin-sharp',
options: {
quality: 100,
stripMetadata: true,
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'content',
path: path.join(__dirname, 'src', 'content'),
},
},
{
resolve: `gatsby-plugin-nprogress`,
options: {
color: '#26A6ED',
showSpinner: false,
},
},
{
resolve: `@gatsby-contrib/gatsby-plugin-elasticlunr-search`,
options: {
// Fields to index
fields: [`title`, `excerpt`, `tags`, `keywords`],
// 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.frontmatter.excerpt,
tags: node => node.frontmatter.tags,
keywords: node => node.frontmatter.keywords,
node: node => node,
},
},
// Optional filter to limit indexed nodes
filter: (node, getNode) => node.frontmatter.tags !== 'exempt',
},
},
{
resolve: 'gatsby-plugin-robots-txt',
options: {
resolveEnv: () => NETLIFY_ENV,
env: {
development: {
policy: [{ userAgent: '*', disallow: ['/'] }],
},
production: {
policy: [{ userAgent: '*' }],
},
'branch-deploy': {
policy: [{ userAgent: '*', disallow: ['/'] }],
sitemap: null,
host: null,
},
'deploy-preview': {
policy: [{ userAgent: '*', disallow: ['/'] }],
sitemap: null,
host: null,
},
},
},
},
{
resolve: `gatsby-transformer-rehype`,
options: {
filter: node => node.internal.type === `MarkdownRemark`,
source: node => node.rawMarkdownBody,
contextFields: [],
fragment: true,
space: `html`,
emitParseErrors: false,
verbose: true,
plugins: [],
},
},
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
{
resolve: 'gatsby-remark-responsive-iframe',
options: {
wrapperStyle: 'margin-bottom: 1rem',
},
},
'gatsby-remark-prismjs',
'gatsby-remark-copy-linked-files',
'gatsby-remark-smartypants',
'gatsby-remark-abbr',
{
resolve: 'gatsby-remark-images',
options: {
maxWidth: 2000,
quality: 100,
},
},
],
},
},
'gatsby-transformer-json',
{
resolve: 'gatsby-plugin-canonical-urls',
options: {
siteUrl: 'https://soyuj.com.np',
},
},
'gatsby-plugin-emotion',
'gatsby-plugin-typescript',
'gatsby-transformer-sharp',
'gatsby-plugin-react-helmet',
'gatsby-transformer-yaml',
{
resolve: `gatsby-plugin-feed`,
options: {
query: `
{
site {
siteMetadata {
title
description
siteUrl
site_url: siteUrl
}
}
}
`,
feeds: [
{
serialize: ({ query: { site, allMarkdownRemark } }) => {
return allMarkdownRemark.edges.map(edge => {
return Object.assign({}, edge.node.frontmatter, {
description: edge.node.frontmatter.excerpt,
date: edge.node.frontmatter.date,
url: site.siteMetadata.siteUrl + edge.node.fields.slug,
guid: site.siteMetadata.siteUrl + edge.node.fields.slug,
custom_elements: [
{ 'content:encoded': filterHTML(edge.node.html, site.siteMetadata.siteUrl) },
],
});
});
},
query: `
{
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] },
) {
edges {
node {
html
fields { slug }
frontmatter {
title
excerpt
date
}
}
}
}
}
`,
output: '/rss.xml',
title: `Soyuj Jung Basnet Blogs' RSS Feed`,
// optional configuration to insert feed reference in pages:
// if `string` is used, it will be used to create RegExp and then test if pathname of
// current page satisfied this regular expression;
// if not provided or `undefined`, all pages will have feed reference inserted
match: '^/blog/',
// optional configuration to specify external rss feed, such as feedburner
link: 'https://feeds.feedburner.com/sjbblogs',
},
],
},
},
{
resolve: 'gatsby-plugin-postcss',
options: {
postCssPlugins: [require('postcss-color-function'), require('cssnano')()],
},
},
{
resolve: 'gatsby-plugin-google-analytics',
options: {
trackingId: 'UA-174291638-1',
// Puts tracking script in the head instead of the body
head: true,
// IP anonymization for GDPR compliance
anonymize: true,
// Disable analytics for users with `Do Not Track` enabled
respectDNT: true,
// Avoids sending pageview hits from custom paths
exclude: ['/preview/**'],
// Specifies what percentage of users should be tracked
sampleRate: 100,
// Determines how often site speed tracking beacons will be sent
siteSpeedSampleRate: 10,
},
},
{
resolve: 'gatsby-plugin-page-progress',
options: {
includePaths: [{ regex: '^/blog/' }],
excludePaths: ["/blog/",{ regex: '^/blog/tags' }, '/blog/explore', { regex: '^/blog/author' }],
height: 3,
prependToBody: false,
color: `#663399`,
footerHeight: 500,
},
},
],
};