-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocusaurus.config.js
232 lines (227 loc) · 6.02 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
// 导入公式渲染模块remark-math和rehype-katex
import remarkMath from "remark-math";
import rehypeKatex from "rehype-katex";
// 设置明暗模式
const lightCodeTheme = require("prism-react-renderer").themes.vsLight;
const darkCodeTheme = require("prism-react-renderer").themes.vsDark;
// 用户自定义
const username = "jiangyang";
const websitename = "jiangmiemie";
const githubusername = "jiangyangcreate";
const websiteurl = `https://${websitename}.com`;
const githubuserRepository = `${githubusername}.github.io`;
const githuborgurl = `https://github.com/${githubusername}/${githubuserRepository}`;
module.exports = {
title: websitename,
tagline: "真实的记录自己,比获得他人的认同感更重要",
favicon: "favicon.ico",
url: websiteurl,
baseUrl: "/",
organizationName: websitename, // Usually your GitHub org/user name.
projectName: githubuserRepository, // Usually your repo name.
deploymentBranch: "gh-pages",
trailingSlash: true, // 让 algolia 抓取更完整
presets: [
[
"@docusaurus/preset-classic",
{
theme: {
customCss: [
require.resolve("./src/theme/custom.css"),
],
},
// gtag: {
// trackingID: "G-4GF73PJ1H7",
// anonymizeIP: true,
// },
sitemap: {
changefreq: "weekly",
priority: 0.5,
},
docs: false,
blog: false,
pages: {
path: "src/pages",
routeBasePath: "",
include: ["**/*.{js,jsx,ts,tsx,md,mdx}"],
exclude: [
"**/_*.{js,jsx,ts,tsx,md,mdx}",
"**/_*/**",
"**/*.test.{js,jsx,ts,tsx}",
"**/__tests__/**",
],
mdxPageComponent: "@theme/MDXPage",
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
beforeDefaultRemarkPlugins: [],
beforeDefaultRehypePlugins: [],
},
},
],
],
plugins: [
[
"@docusaurus/plugin-pwa",
{
debug: true,
offlineModeActivationStrategies: [
"appInstalled",
"standalone",
"queryString",
],
pwaHead: [
{
tagName: "link",
rel: "icon",
href: "/img/logo-512.svg",
},
{
tagName: "link",
rel: "manifest",
href: "/manifest.json", // your PWA manifest
},
{
tagName: "meta",
name: "theme-color",
content: "rgb(37, 194, 160)",
},
],
},
],
[
"@docusaurus/plugin-content-docs",
{
id: "read",
path: "docs/read",
routeBasePath: "read",
sidebarPath: require.resolve("./sidebars.js"),
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
],
[
"@docusaurus/plugin-content-docs",
{
id: "docs",
path: "docs/docs",
routeBasePath: "docs",
sidebarPath: require.resolve("./sidebars.js"),
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
],
[
"@docusaurus/plugin-content-blog",
{
routeBasePath: "/blog",
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
showReadingTime: true,
// postsPerPage: 9,
blogSidebarCount: 0,
feedOptions: {
type: "all",
createFeedItems: async (params) => {
const { blogPosts, defaultCreateFeedItems, ...rest } = params;
return defaultCreateFeedItems({
blogPosts: blogPosts.filter((item, index) => index < 99),
...rest,
});
},
},
},
],
],
// 开启markdown的mermaid功能 , live-codeblock
themes: ["@docusaurus/theme-mermaid", "@docusaurus/theme-live-codeblock"],
markdown: {
mermaid: true,
},
stylesheets: [
{
href: "/katex/katex.min.css",
type: "text/css",
},
],
themeConfig: {
// Replace with your project's social card
image: "/pages/case/jiangmiemie.webp",
// 为亮色和暗色模式指定图表的主题
mermaid: {
theme: { light: "neutral", dark: "forest" },
},
metadata: [
{
name: "keywords",
content: "docusaurus,blog, python, 开源",
},
],
//全局索引插件
algolia: {
appId: "B8DUWB4CMX",
apiKey: "36cbcb8eb4d417b32200be7e427d68fd",
indexName: websitename,
},
colorMode: {
defaultMode: "light", //定义首次访问的颜色
disableSwitch: true, //隐藏明暗切换按钮
respectPrefersColorScheme: true, //跟随用户系统默认
},
//配置标准的明暗主题
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
defaultLanguage: "markdown",
},
//告示条
// announcementBar: {
// id: 'support',
// content:
// `🚀 如果你觉得还不错, 可以上 <a target="_blank" rel="noopener noreferrer" href="${githuborgurl}" aria-label="star on github ">Github</a> 克隆这个站点。`,
// isCloseable: true,//允许用户关闭
// },
navbar: {
hideOnScroll: false,
items: [
{
position: "left",
label: "文档",
items: [
{
label: "开发",
to: "/docs",
},
{
label: "书架",
to: "/read",
},
],
},
{
to: "/blog/archive",
position: "left",
label: "博文",
},
{
to: "/case",
position: "left",
label: "个案",
},
{
to: "/gallery",
position: "left",
label: "相簿",
},
// 搜索框
{
type: "search",
position: "right",
},
],
},
footer: {
style: "light",
copyright: `<div style="font-size: 0.75rem;">Copyright © ${username} ${new Date().getFullYear()}<div/>`,
},
},
};