-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocusaurus.config.js
238 lines (227 loc) · 6.69 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
// @ts-check
// `@type` JSDoc注解可实现编辑器自动补全和类型检查
// (需配合 `@ts-check` 使用)
// 有多种等效方式来声明Docusaurus配置
// 详见: https://docusaurus.io/docs/api/docusaurus-config
import { themes as prismThemes } from "prism-react-renderer"
const navbar = require('./config/navbar')
const additionalLanguages = require('./config/additionalLanguages')
// 此代码运行在Node.js环境 - 禁止使用客户端代码(浏览器API、JSX等)
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Sumingcheng's Document Center",
tagline: "Document Center",
favicon: "img/favicon.ico",
// 设置网站生产环境URL
url: "https://sumingcheng.github.io",
// 设置网站服务的基础路径
// GitHub pages部署通常为'/<projectName>/'
baseUrl: "/docs-hub/",
// GitHub pages部署配置
// 如不使用GitHub pages可忽略以下配置
organizationName: "sumingcheng", // 通常是GitHub组织/用户名
projectName: "docs-hub", // 通常是仓库名
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
// 元数据必须设置
// 例如,中文网站可将"en"替换为"zh-CN"
i18n: {
defaultLocale: "zh-CN",
locales: ["zh-CN"],
localeConfigs: {
"zh-CN": {
label: "简体中文",
},
},
},
plugins: ['docusaurus-plugin-sass'],
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: "./config/sidebars.js",
editUrl: "https://github.com/sumingcheng/docs-hub/edit/main/",
showLastUpdateTime: true,
showLastUpdateAuthor: true,
routeBasePath: '/',
},
blog: {
path: 'blog',
routeBasePath: 'blog',
include: ['**/*.{md,mdx}'],
blogSidebarCount: "ALL",
blogSidebarTitle: '所有文章',
sortPosts: 'descending',
showReadingTime: true,
readingTime: ({ content, frontMatter, defaultReadingTime }) =>
defaultReadingTime({ content, options: { wordsPerMinute: 300 } }),
feedOptions: {
type: ["rss", "atom"],
xslt: true,
},
editUrl: "https://github.com/sumingcheng/docs-hub",
onInlineTags: "warn",
onInlineAuthors: "warn",
onUntruncatedBlogPosts: "ignore"
},
theme: {
// 不可使用SCSS
customCss: [
"./src/css/custom.css",
"./src/css/article.css",
"./src/css/navbar.css"
],
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// 替换为你项目的社交卡片
image: "img/docusaurus-social-card.jpg",
metadata: [
{
name: "keywords",
content:
"素明诚, sumingcheng, 技术文档, 博客, 前端开发, 后端开发, Web开发, JavaScript, TypeScript, Vue, React, Go, Python, Java",
},
{
name: "description",
content:
"素明诚的技术文档和博客,涵盖前端、后端、Web3等多个技术领域的学习笔记和开发经验分享",
},
{
name: "author",
content: "素明诚 (sumingcheng)",
},
],
head: [
// 添加多个思源黑体 CDN 源以提高可用性
{
tagName: "link",
rel: "stylesheet",
href: "https://npm.elemecdn.com/[email protected]/dist/source-han-sans-sc.css",
},
{
tagName: "link",
rel: "stylesheet",
href: "https://cdn.bootcdn.net/ajax/libs/source-han-sans-sc/1.001/source-han-sans-sc.min.css",
},
{
tagName: "link",
rel: "stylesheet",
href: "https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap",
},
{
tagName: "link",
rel: "stylesheet",
href: "https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap",
},
],
navbar: navbar,
footer: {
style: "dark",
links: [
{
title: "LinkExchange",
items: [
{
label: "Leviatan",
href: "https://leviatan.cn",
},
// {
// label: "知乎",
// href: "https://www.zhihu.com/people/xiaolaodi.top",
// },
],
},
{
title: "Acknowledgments",
items: [
{
label: "React",
href: "https://react.dev",
},
{
label: "Docusaurus",
href: "https://docusaurus.io",
},
],
},
{
title: "More",
items: [
{
label: "Blog",
href: "https://sumingcheng.cn",
},
{
label: "GitHub",
href: "https://github.com/sumingcheng",
},
],
},
],
copyright: `Copyright \u00A9 2020-${new Date().getFullYear()} Sumingcheng. All Rights Reserved.`,
},
algolia: {
apiKey: "bf04ca982f837db058533013bca8fdf6",
indexName: "sumingchengio",
appId: "392UN2TOHD",
searchPagePath: "search",
contextualSearch: true,
searchParameters: {
hitsPerPage: 8,
},
replaceSearchResultPathname: {
from: '/docs-hub/',
to: '/docs-hub/',
},
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
additionalLanguages: additionalLanguages,
},
docs: {
sidebar: {
hideable: true,
autoCollapseCategories: true,
},
},
tableOfContents: {
minHeadingLevel: 2,
maxHeadingLevel: 4,
},
giscus: {
repo: 'sumingcheng/docs-hub',
repoId: 'R_kgDOKQ1N4Q',
category: 'Announcements',
categoryId: 'DIC_kwDOKQ1N4c4Ckrcs',
mapping: 'pathname',
reactionsEnabled: '1',
emitMetadata: '0',
inputPosition: 'top',
lang: 'zh-CN',
loading: 'lazy',
theme: 'preferred_color_scheme',
},
}),
scripts: [
{
src: "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js",
async: true,
crossorigin: "anonymous",
},
],
customFields: {
carbonServeId: "CVYD42T7", // Carbon Ads ID
},
future: {
experimental_faster: true, // 启用实验性能优化
},
}
export default config