-
Notifications
You must be signed in to change notification settings - Fork 1
/
gatsby-config.js
176 lines (174 loc) · 5.04 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
/* eslint-disable */
module.exports = ({
contentAuthors = 'content/authors',
contentPosts = 'content/posts',
pathPrefix = '',
}) => ({
pathPrefix,
plugins: [
`gatsby-plugin-typescript`,
`gatsby-plugin-react-helmet`,
`gatsby-image`,
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
`gatsby-transformer-remark`,
`gatsby-transformer-yaml`,
`gatsby-plugin-theme-ui`,
`gatsby-plugin-sitemap`,
{
resolve: `gatsby-plugin-feed`,
options: {
query: `
{
site {
siteMetadata {
title
description
siteUrl
site_url: siteUrl
}
}
}
`,
setup: ({
query: {
site: { siteMetadata },
},
...rest
}) => {
siteMetadata.feed_url = siteMetadata.siteUrl + '/rss.xml';
siteMetadata.image_url =
siteMetadata.siteUrl + '/icons/icon-512x512.png';
const siteMetadataModified = siteMetadata;
siteMetadataModified.feed_url = `${siteMetadata.siteUrl}/rss.xml`;
siteMetadataModified.image_url = `${siteMetadata.siteUrl}/icons/icon-512x512.png`;
return {
...siteMetadataModified,
...rest,
};
},
feeds: [
{
title: "blog-feed",
serialize: ({ query: { site, allArticle } }) => {
return allArticle.edges
.filter(edge => !edge.node.secret)
.map(edge => {
return {
...edge.node,
description: edge.node.excerpt,
date: edge.node.date,
url: site.siteMetadata.siteUrl + edge.node.slug,
guid: site.siteMetadata.siteUrl + edge.node.slug,
// body is raw JS and MDX; will need to be processed before it can be used
// custom_elements: [{ "content:encoded": edge.node.body }],
author: edge.node.author,
};
});
},
query:
`{
allArticle(sort: {date: DESC}) {
edges {
node {
body
excerpt
date
slug
title
author
secret
}
}
}
}`,
output: '/rss.xml',
},
],
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: contentPosts,
name: contentPosts,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: contentAuthors,
name: contentAuthors,
},
},
{
resolve: `gatsby-plugin-mdx`,
options: {
extensions: [`.mdx`, `.md`],
gatsbyRemarkPlugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 800,
linkImagesToOriginal: false,
quality: 80,
withWebp: true,
},
},
{
resolve: `@raae/gatsby-remark-oembed`,
options: {
usePrefix: ["oembed", "video"],
providers: {
include: ["Twitter", "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', // eslint-disable-line unicorn/prevent-abbreviations
},
},
{
resolve: `@sudaraka94/gatsby-remark-link-unfurl`,
options: {
processedUrlsFile: `${__dirname}/link-cache/cache.json`,
},
},
],
mdxOptions: {
rehypePlugins: [
{ resolve: "rehype-slug" }
]
}
},
},
{
resolve: `gatsby-plugin-emotion`,
options: {
autoLabel: 'dev-only',
},
},
],
});