-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
364 lines (354 loc) · 10.4 KB
/
docusaurus.config.js
File metadata and controls
364 lines (354 loc) · 10.4 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
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
// 导入公式渲染模块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}`;
// 站点描述:用于 meta description / og:description / JSON-LD。
// TODO(jiangyang): 这段是占位文案,等你亲自打磨一版正式简介后替换。
const siteDescription =
"jiangmiemie(江洋)的个人数字档案馆:记录关于 Python、AI Agent、阅读与影像的思考与笔记。";
// 站点社交卡图(绝对 URL)
const siteImage = `${websiteurl}/pages/case/jiangmiemie.webp`;
// 结构化数据:Person + WebSite + Blog。
// 让 AI 检索类爬虫与搜索引擎能直接拿到清晰的实体关系。
const personSchema = {
"@context": "https://schema.org",
"@type": "Person",
name: "jiangmiemie",
alternateName: ["江洋", "Allen", "jiangyang"],
url: websiteurl,
image: siteImage,
description: siteDescription,
sameAs: [
`https://github.com/${githubusername}`,
githuborgurl,
],
knowsAbout: ["Python", "AI Agent", "Web Development", "Reading", "Photography"],
};
const websiteSchema = {
"@context": "https://schema.org",
"@type": "WebSite",
name: websitename,
url: websiteurl,
description: siteDescription,
inLanguage: "zh-CN",
publisher: { "@id": `${websiteurl}/#person` },
author: { "@id": `${websiteurl}/#person` },
potentialAction: {
"@type": "SearchAction",
target: {
"@type": "EntryPoint",
urlTemplate: `${websiteurl}/search?q={search_term_string}`,
},
"query-input": "required name=search_term_string",
},
};
const blogSchema = {
"@context": "https://schema.org",
"@type": "Blog",
name: `${websitename} · 博文`,
url: `${websiteurl}/blog/archive/`,
description: siteDescription,
inLanguage: "zh-CN",
author: { "@id": `${websiteurl}/#person` },
};
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 抓取更完整
i18n: {
defaultLocale: "zh-CN",
locales: ["zh-CN"],
},
// 全站头部注入:llms.txt 提示 + 结构化数据。AI 检索爬虫与搜索引擎可直接消费。
headTags: [
{
tagName: "link",
attributes: {
rel: "alternate",
type: "text/plain",
title: "llms.txt",
href: "/llms.txt",
},
},
{
tagName: "link",
attributes: {
rel: "alternate",
type: "text/plain",
title: "llms-full.txt",
href: "/llms-full.txt",
},
},
{
tagName: "script",
attributes: { type: "application/ld+json" },
innerHTML: JSON.stringify({ ...personSchema, "@id": `${websiteurl}/#person` }),
},
{
tagName: "script",
attributes: { type: "application/ld+json" },
innerHTML: JSON.stringify({ ...websiteSchema, "@id": `${websiteurl}/#website` }),
},
{
tagName: "script",
attributes: { type: "application/ld+json" },
innerHTML: JSON.stringify({ ...blogSchema, "@id": `${websiteurl}/#blog` }),
},
],
presets: [
[
"@docusaurus/preset-classic",
{
theme: {
customCss: [
require.resolve("./src/theme/custom.css"),
],
},
// gtag: {
// trackingID: "G-4GF73PJ1H7",
// anonymizeIP: true,
// },
sitemap: {
changefreq: "weekly",
priority: 0.7,
ignorePatterns: ["/tags/**"],
filename: "sitemap.xml",
},
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: "description", content: siteDescription },
{ name: "author", content: "jiangmiemie" },
{
name: "keywords",
content:
"jiangmiemie,江洋,jiangyang,Python,AI Agent,大模型应用,Docusaurus,个人博客,开源,阅读笔记",
},
// Open Graph
{ property: "og:type", content: "website" },
{ property: "og:site_name", content: websitename },
{ property: "og:title", content: websitename },
{ property: "og:description", content: siteDescription },
{ property: "og:url", content: websiteurl },
{ property: "og:image", content: siteImage },
{ property: "og:locale", content: "zh_CN" },
// Twitter / X
{ name: "twitter:card", content: "summary_large_image" },
{ name: "twitter:title", content: websitename },
{ name: "twitter:description", content: siteDescription },
{ name: "twitter:image", content: siteImage },
],
//全局索引插件
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: "相簿",
},
{
label: '其他',
position: 'left',
items: [
{
label: '云盘',
href: 'https://yun.jiangmiemie.com',
},
{
label: 'AI助手',
href: 'https://ai.jiangmiemie.com',
},
],
},
// 搜索框
{
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/>`,
},
},
};