-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocusaurus.config.js
304 lines (287 loc) · 8.42 KB
/
docusaurus.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
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
// @ts-check
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config
import { themes as prismThemes } from 'prism-react-renderer';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
import imgWrapper from './plugins/rehype/imgWrapper';
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'SQYBI.com',
tagline: 'Change is a part of life and takes part in finding us who we are.',
favicon: 'img/favicon.ico',
titleDelimiter: '|',
// Set the production url of your site here
url: 'https://sqybi.com',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
trailingSlash: true,
staticDirectories: ['static'],
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'sqybi', // Usually your GitHub org/user name.
projectName: 'SQYBI.com', // Usually your repo name.
deploymentBranch: 'main', // The branch of your site that GitHub pages will deploy from.
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'zh-Hans',
locales: ['zh-Hans', 'en-US'],
path: 'i18n',
localeConfigs: {
'zh-Hans': {
label: '简体中文',
direction: 'ltr',
htmlLang: 'zh-Hans',
calendar: 'gregory',
},
'en-US': {
label: 'English',
direction: 'ltr',
htmlLang: 'en-US',
calendar: 'gregory',
path: 'en-US',
},
},
},
markdown: {
format: 'detect',
mermaid: true,
},
presets: [
[
'@docusaurus/preset-classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: false,
blog: {
showReadingTime: true,
readingTime: ({ content, frontMatter, defaultReadingTime }) =>
defaultReadingTime({ content, options: { wordsPerMinute: 300 } }),
postsPerPage: 10,
feedOptions: {
xslt: true,
type: 'all',
description: 'Change is a part of life and takes part in finding us who we are.',
copyright: `Copyright © 2023-${new Date().getFullYear()} SQYBI.com.`,
createFeedItems: async (params) => {
const { blogPosts, defaultCreateFeedItems, ...rest } = params;
return defaultCreateFeedItems({
// keep only the 50 most recent blog posts in the feed
blogPosts: blogPosts.filter((item, index) => index < 50),
...rest,
});
},
},
blogSidebarTitle: '近期文章',
blogSidebarCount: 20,
remarkPlugins: [
remarkMath,
],
rehypePlugins: [
rehypeKatex,
imgWrapper,
],
onInlineTags: 'throw',
onUntruncatedBlogPosts: 'warn',
},
theme: {
customCss: [
'./src/css/custom-font.css',
'./src/css/custom.css',
],
},
sitemap: {
changefreq: 'weekly',
priority: 0.5,
ignorePatterns: ['/tags/**'],
filename: 'sitemap.xml',
},
gtag: {
trackingID: 'G-SBSGLRW6MK',
},
}),
],
],
themes: [
'@docusaurus/theme-mermaid'
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
metadata: [],
colorMode: {
defaultMode: 'light',
disableSwitch: false,
respectPrefersColorScheme: true,
},
// announcementBar: {
// id: 'archive',
// content:
// '网站增加了“所有文章”页面,可以从导航栏点击访问,或从<a href="/archive">这里</a>访问',
// backgroundColor: "var(--ifm-color-secondary)",
// isCloseable: true,
// },
tableOfContents: {
minHeadingLevel: 2,
maxHeadingLevel: 4,
},
navbar: {
title: 'SQYBI.com',
logo: {
alt: 'SQYBI.com Logo',
src: 'img/logo.png',
},
items: [
// Links on the left side of the navbar
{
to: '/blog',
label: '博客',
position: 'left',
},
{
to: '/blog/tags/',
label: '所有标签',
position: 'left',
},
{
to: '/archive',
label: '所有文章',
position: 'left',
},
{
to: '/links',
label: "友情链接",
position: 'left',
},
{
to: '/about',
label: "十几个为什么",
position: 'left',
},
{
to: 'pathname:///blog/rss.xml',
label: "📶RSS",
position: 'left',
},
// Links on the right side of the navbar
{
type: 'dropdown',
label: '我的',
position: 'right',
items: [
{
label: '✈️ Telegram',
href: 'https://t.me/sqybi',
},
{
label: '🐱 GitHub',
href: 'https://github.com/sqybi',
},
{
label: '📷 Flickr',
href: 'https://www.flickr.com/sqybi',
},
{
label: '📺 Bilibili',
href: 'https://space.bilibili.com/105879',
},
{
label: '🐦 Twitter',
href: 'https://twitter.com/sqybi',
},
{
label: '📘 Facebook',
href: 'https://facebook.com/sqybi',
},
],
},
{
type: 'localeDropdown',
position: 'right',
},
],
},
footer: {
style: 'dark',
copyright: `Copyright © 2023-${new Date().getFullYear()} SQYBI.com<br />Built with Docusaurus. Served by Cloudflare.<br /><a href=\"https://www.foreverblog.cn/blog/5675/cert.html\" target=\"_blank\"><img src=\"https://img.foreverblog.cn/logo_en_default.png\" alt=\"\" style=\"width:auto;height:16px;\"></a>`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
mermaid: {
theme: {
light: 'neutral',
dark: 'forest',
},
options: {},
},
}),
plugins: [
[
'@docusaurus/plugin-ideal-image',
{
quality: 70,
max: 2560, // max resized image's size.
min: 640, // min resized image's size. if original is lower, use that size.
steps: 4, // the max number of images generated between min and max (inclusive)
disableInDev: false,
},
],
'./plugins/blog-list',
'./plugins/inject-tags',
],
scripts: [
{
src: 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.2.0/crypto-js.min.js',
async: true,
},
{
src: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/medium-zoom.min.js',
async: true,
},
{
src: 'https://cloud.umami.is/script.js',
'data-website-id': 'a7ce7043-3c90-4cde-89f9-d8eeff1dcec8',
defer: true,
},
],
stylesheets: [
{
href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css',
type: 'text/css',
integrity:
'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM',
crossorigin: 'anonymous',
},
{
href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/style.min.css',
type: 'text/css',
}
],
customFields: {
giscusRepoId: process.env.GISCUS_REPO_ID,
giscusCategoryId: process.env.GISCUS_CATEGORY_ID,
commentServiceUrl: process.env.COMMENT_SERVICE_URL,
},
headTags: [
{
tagName: 'meta',
attributes: {
name: 'baidu-site-verification',
content: 'codeva-S7U776qVYB',
},
}
],
future: {
experimental_faster: true,
},
};
export default config;