-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
238 lines (233 loc) · 6.43 KB
/
docusaurus.config.js
File metadata and controls
238 lines (233 loc) · 6.43 KB
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
// 导入公式渲染模块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,
onUntruncatedBlogPosts: 'ignore', // 忽略博客文章缺少截断标记的警告
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,
},
// 如不添加可能会样式异常,展示2次
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", // 站内搜索用的 key
indexName: websitename,
askAi: {
appId: "B8DUWB4CMX",
apiKey: "7324233c84b4ffb7c51f7a11136750a9",
indexName: "markdown-index", // 你的 markdown 索引名
assistantId: "PSPEr8rtpc0W",
// Docusaurus 3.9 当前的 schema 不支持 suggestedQuestions 字段
},
},
colorMode: {
defaultMode: "light", //定义首次访问的颜色
disableSwitch: false, //隐藏明暗切换按钮
respectPrefersColorScheme: true, //跟随用户系统默认
},
//配置标准的明暗主题
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
defaultLanguage: "markdown",
additionalLanguages: ['toml','yaml','bash'],
},
// 告示条
// announcementBar: {
// id: 'support',
// content:
// `全局AI问答、博客AI总结、博客转AI播客功能均已上线 🚀 `,
// isCloseable: true,//允许用户关闭
// },
navbar: {
hideOnScroll: false,
items: [
{
to: "/docs",
position: "left",
label: "开发",
},
{
to: "/read",
position: "left",
label: "书架",
},
{
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()} ⭐ <a href="${githuborgurl}" target="_blank">Open Source on GitHub</a><div/>`,
},
},
};