forked from binnyva/gatsby-garden
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
executable file
·208 lines (194 loc) · 7.11 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
module.exports = {
// Gatsby Config
// pathPrefix: `/notes`, // If your Digital Garden is not published at the root of your website, use this.
trailingSlash: 'never', // Remove all trailing slashes on each URL, e.g. /x/ to /x
siteMetadata: {
title: `Gatsby Garden`,
description: `A Digital Garden tended by Gatsby`,
// siteUrl: `https://yoursite.com/notes/`, // URL at which your site will be published. This should be present if you want RSS feed.
// headerMenu: [ // Top Navbar items
// {type: 'page', item: '', title: 'Home'}, // Type can be 'page', 'note', 'tag', or 'link'
// {type: 'page', item: 'sitemap', title: 'Sitemap'},
// {type: 'page', item: 'rss.xml', title: 'RSS'},
// {
// type: 'page', item: 'tags', title: 'Tags',
// menu: [ // Only one level depth, please.
// {type: 'tag',item: 'zettelkasten'},
// {type: 'tag',item: 'philosophy'},
// {type: 'tag',item: 'psychology'},
// {type: 'tag',item: 'rationality'},
// ]
// },
// ],
// menu: [ // This is the Table of Contents that comes in the home page if a Home Note is not specified. It can be much longer than the header menu.
// ... Same structure as headerMenu. You can have any depth level - multiple menus can be nested.
// ],
hoverPreview: true // If true, shows the content of an internal link in a tooltip when hovering over the link.
},
plugins: [
`gatsby-plugin-sharp`,
`gatsby-remark-images`,
`gatsby-plugin-dark-mode`,
// { // Enable this if you want to have an RSS Feed. The `siteMetadata.siteUrl` property should be present for this to work
// // Also, you'll need to install this library. To do that, run the command `npm install gatsby-plugin-feed-mdx --save` in the same directory as this gatsby-config.js file.
// resolve: `gatsby-plugin-feed`,
// options: {
// query: `
// {
// site {
// siteMetadata {
// title
// description
// siteUrl
// site_url: siteUrl
// }
// }
// }
// `,
// feeds: [
// {
// serialize: ({ query: { site, allMdx } }) => {
// return allMdx.edges.map(edge => {
// return Object.assign({}, edge.node.fields, {
// description: edge.node.excerpt,
// date: edge.node.fields.date,
// url: site.siteMetadata.siteUrl + edge.node.fields.slug,
// guid: site.siteMetadata.siteUrl + edge.node.fields.slug,
// custom_elements: [{ "content:encoded": edge.node.html }]
// });
// });
// },
// query: `
// {
// allMdx(
// limit: 20,
// sort: { order: DESC, fields: [fields___date] },
// ) {
// edges {
// node {
// excerpt
// html
// fields { slug date title }
// }
// }
// }
// }
// `,
// output: "/rss.xml",
// title: "RSS Feed",
// }
// ]
// }
// },
{
resolve: `gatsby-source-filesystem`,
options: {
name: `notes`,
path: `${__dirname}/_notes/`,
},
},
{
resolve: `gatsby-plugin-mdx`,
options: {
extensions: [`.mdx`, `.md`],
gatsbyRemarkPlugins: [
'gatsby-remark-mermaid',
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 1200,
},
},
{
resolve: 'gatsby-remark-obsidian',
options: {
titleToURL: require(`${__dirname}/src/utils/make-slug.js`)
}
}
],
},
},
// {
// resolve: `gatsby-plugin-google-fonts`,
// options: {
// fonts: [`IBM Plex Sans:ital,wght@0,400;0,600;1,400;1,600`],
// display: `swap`,
// },
// },
{
resolve: `gatsby-plugin-purgecss`,
options: {
// printRejected: true, // Print removed selectors and processed file names. Use for debugging.
// develop: true, // Enable while using `gatsby develop`
// tailwind: true, // Enable tailwindcss support
ignore: ['tippy.js/', 'tooltip.css'], // Ignore files/folders
// purgeOnly : ['components/', '/main.css', 'bootstrap/'], // Purge only these files/folders
purgeCSSOptions: {
safelist: ['.tippy-box'], // Don't remove this selector
},
// More options defined here https://purgecss.com/configuration.html#options
},
},
{
resolve: 'gatsby-plugin-local-search',
options: {
// A unique name for the search index. This should be descriptive of
// what the index contains. This is required.
name: 'notes_index',
// Set the search engine to create the index. This is required.
// The following engines are supported: flexsearch, lunr
engine: 'flexsearch',
// Provide options to the engine. This is optional and only recommended for advanced users.
// Note: Only the flexsearch engine supports options.
engineOptions: {
present: 'speed',
tokenize: 'forward'
},
// GraphQL query used to fetch all data for the search index. This is required.
query: `
{
allMdx(filter: {
fields: { visibility: { eq: "public" } }
}) {
nodes {
id
fields {
title
slug
excerpt
}
frontmatter {
tags
}
rawBody
excerpt
}
}
}
`,
// Field used as the reference value for each document. Default: 'id'.
ref: 'id',
// List of keys to index. The values of the keys are taken from the normalizer function below.
// Default: all fields
index: ['title', 'body', 'tags'],
// List of keys to store and make available in your UI. The values of
// the keys are taken from the normalizer function below.
// Default: all fields
store: ['id', 'slug', 'title', 'excerpt'],
// 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. The objects must contain the `ref`
// field above (default: 'id'). This is required.
normalizer: ({ data }) =>
data.allMdx.nodes.map(node => ({
id: node.id,
slug: node.fields.slug,
title: node.fields.title,
excerpt: node.fields.excerpt ? node.fields.excerpt : node.excerpt,
tags: node.frontmatter.tags,
body: node.rawBody,
})),
},
},
],
}