/
gatsby-config.js
186 lines (183 loc) · 5.19 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
const getRssBody = (url, html) => {
const mainBody = html.match(/<main>((.|\n)*)<\/main>/g)[0]
const mainBodyWithStaticUrls = mainBody.replace(
/(?<="|\s)\/static\//g,
`${url}/static/`
)
return {
custom_elements: [
{
'content:encoded': mainBodyWithStaticUrls,
},
],
}
}
module.exports = {
siteMetadata: {
title: 'Nerd Cowboy',
description:
'UI/UX Designer & Front-end Developer Brent Larson is a problem solver that designs & develops clean and easy-to-use websites that are as slick as a whistle.',
author: 'Brent Larson',
siteUrl: 'https://nerdcowboy.com',
repo: {
baseUrl: 'https://github.com/NerdCowboy/nerdcowboy/',
contentPath: 'tree/master/content',
viewContentPath: 'blob/master/content',
editContentPath: 'edit/master/content',
},
},
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/content/blog`,
name: `blog`,
ignore: [`${__dirname}/content/blog/drafts`],
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/content/pages`,
name: `pages`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `media`,
path: `${__dirname}/src/media`,
},
},
{
resolve: 'gatsby-plugin-sass',
options: {
additionalData: `
@import "${__dirname}/src/styles/resources";`,
},
},
{
resolve: 'gatsby-plugin-react-svg',
options: {
rule: {
include: /svgs/,
},
},
},
`gatsby-plugin-mdx-embed`,
`gatsby-plugin-image`,
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
`gatsby-remark-images`,
{
resolve: `gatsby-plugin-mdx`,
options: {
extensions: ['.mdx', '.md'],
gatsbyRemarkPlugins: [
{
resolve: `gatsby-remark-images`,
options: {
// It's important to specify the maxWidth (in pixels) of
// the content container as this plugin uses this as the
// base for generating different widths of each image.
maxWidth: 655,
withAvif: true,
withWebp: true,
},
},
{
resolve: `gatsby-remark-embedder`,
options: {
customTransformers: [
// Your custom transformers
],
services: {
// The service-specific options by the name of the service
},
},
},
{
resolve: `gatsby-remark-responsive-iframe`,
options: {
wrapperStyle: `margin-bottom: 1.0725rem`,
},
},
{
resolve: `gatsby-remark-autolink-headers`,
options: {
className: 'headerAnchorLink',
},
},
`gatsby-remark-copy-linked-files`,
`gatsby-remark-smartypants`,
],
},
},
{
resolve: `gatsby-plugin-feed-mdx`,
options: {
query: `
{
site {
siteMetadata {
title
description
siteUrl
site_url: siteUrl
}
}
}
`,
feeds: [
{
serialize: ({ query: { site, allMdx } }) =>
allMdx.edges.map((edge) => ({
...edge.node.frontmatter,
description: edge.node.frontmatter.description,
tags: edge.node.frontmatter.tags,
date: edge.node.frontmatter.date,
url: `${site.siteMetadata.siteUrl}${edge.node.fields.slug}`,
guid: `${site.siteMetadata.siteUrl}${edge.node.fields.slug}`,
...getRssBody(site.siteMetadata.siteUrl, edge.node.html),
})),
query: `
{
allMdx(
filter: { fields: { contentType: { eq: "blog" } } }
sort: { order: DESC, fields: [frontmatter___date] },
) {
edges {
node {
excerpt
html
fields {
slug
contentType
}
frontmatter {
date(formatString: "MMMM DD, YYYY")
title
subtitle
description
tags
}
}
}
}
}
`,
output: '/rss.xml',
title: 'Nerd Cowboy',
// 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/',
},
],
},
},
`gatsby-plugin-offline`,
`gatsby-plugin-react-helmet`,
],
}