forked from OI-wiki/gatsby-oi-wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
173 lines (172 loc) · 5.76 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
const path = require('path')
module.exports = {
siteMetadata: {
title: 'OI Wiki',
description: 'Guide for OI',
author: 'OI Wiki Team',
siteUrl: 'https://ng.oi-wiki.org',
},
plugins: [
'gatsby-source-local-git',
{
resolve: 'gatsby-source-filesystem',
options: {
name: './docs/',
path: './docs/',
},
},
'gatsby-plugin-sharp',
'gatsby-transformer-sharp',
{
resolve: 'gatsby-plugin-mdx',
options: {
gatsbyRemarkPlugins: [
{
resolve: 'gatsby-remark-images',
options: {
maxWidth: 900,
withWebp: true,
tracedSVG: false,
linkImagesToOriginal: false,
disableBgImageOnAlpha: true,
},
},
{
resolve: 'gatsby-remark-copy-linked-files',
options: {
// By default, `.md` is specified
// ignoreFileExtensions: ['.md']
// These files will not be copied
ignoreFileExtensions: ['.md'],
},
},
/** {
resolve: `gatsby-remark-autolink-headers`,
options: {
isIconAfterHeader: true,
},
}, */
{
resolve: 'gatsby-local-autolink-headers',
options: {
isIconAfterHeader: true,
},
},
{
resolve: 'gatsby-remark-vscode',
options: {
theme: 'Dark+ (default dark)', // Read on for list of included themes. Also accepts object and function forms.
wrapperClassName: '', // Additional class put on 'pre' tag. Also accepts function to set the class dynamically.
injectStyles: true, // Injects (minimal) additional CSS for layout and scrolling
extensions: [], // Extensions to download from the marketplace to provide more languages and themes
// Absolute path to the directory where extensions will be downloaded. Defaults to inside node_modules.
extensionDataDirectory: path.resolve('extensions'),
languageAliases: {}, // Map of custom/unknown language codes to standard/known language codes
replaceColor: (x) => x, // Function allowing replacement of a theme color with another. Useful for replacing hex colors with CSS variables.
getLineClassName: ({
// Function allowing dynamic setting of additional class names on individual lines
content, // - the string content of the line
index, // - the zero-based index of the line within the code fence
language, // - the language specified for the code fence
meta, // - any options set on the code fence alongside the language (more on this later)
}) => '',
logLevel: 'warn', // Set to 'info' to debug if something looks wrong
},
},
],
remarkPlugins: [require('remark-math'), require('remark-details')],
rehypePlugins: [require('rehype-mathjax'), require('rehype-details')],
extensions: ['.mdx', '.md'],
},
},
{
resolve: 'gatsby-plugin-material-ui',
options: {
stylesProvider: {
injectFirst: true,
},
},
},
'gatsby-plugin-catch-links',
// `gatsby-plugin-theme-ui`,
'gatsby-plugin-react-helmet',
{
resolve: 'gatsby-plugin-manifest',
options: {
name: 'OI Wiki',
short_name: 'OI Wiki',
start_url: '/',
display: 'standalone',
icon: 'icon/favicon_512x512.png',
},
},
{
resolve: 'gatsby-plugin-offline',
options: {
precachePages: [],
workboxConfig: {
importWorkboxFrom: 'local',
globPatterns: ['page-data/**', '*.js'],
runtimeCaching: [
{
urlPattern: /(\.js$|\.css$)/, // js and css
handler: 'CacheFirst',
},
{
urlPattern: /^https?:.*\.(json)$/, // page-data
handler: 'NetworkFirst',
},
{
urlPattern: /^https?:.*\.(woff|woff2)$/, // mathjax fonts
handler: 'StaleWhileRevalidate',
},
{
urlPattern: /^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff)$/, // do not cache images
handler: 'NetworkOnly',
},
],
skipWaiting: true,
clientsClaim: true,
},
},
},
{
resolve: 'gatsby-plugin-advanced-sitemap',
options: {
// 1 query for each data type
query: `
{
allMdx {
edges {
node {
id
fields{
slug
}
}
}
}
}`,
mapping: {
// Each data type can be mapped to a predefined sitemap
// Routes can be grouped in one of: posts, tags, authors, pages, or a custom name
// The default sitemap - if none is passed - will be pages
allMdx: {
sitemap: 'documents',
},
},
exclude: [
'/dev-404-page/',
'/404/',
'/404.html',
'/offline-plugin-app-shell-fallback/',
// `/(\/)?hash-\S*/`, // you can also pass valid RegExp to exclude internal tags for example
],
createLinkInHead: true, // optional: create a link in the `<head>` of your site
addUncaughtPages: true, // optional: will fill up pages that are not caught by queries and mapping and list them under `sitemap-pages.xml`
},
},
// "gatsby-plugin-webpack-bundle-analyser-v2",
// when you need to analyze bundle size, enable it
],
}