-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocusaurus.config.js
280 lines (270 loc) · 7.13 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
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'IODocs',// 网站名
tagline: 'IO0288\'s Docs',// 网站描述
url: 'https://io0288.github.io/',
baseUrl: '/IODocs/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'IO0288', // Usually your GitHub org/user name.
projectName: 'IODocs', // Usually your repo name.
deploymentBranch: 'gh-pages',// 部署的分支
trailingSlash: 'false',
// 预设
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
editUrl: 'https://github.com/IO0288/IODocs/blob/master',
},
blog: {
showReadingTime: true,
// Please change this to your repo.
editUrl:
'https://github.com/IO0288/IODocs/blob/master',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
sitemap: {
changefreq: 'weekly',
priority: 0.5,
},
}),
],
],
// 标题分隔符
titleDelimiter: '🤪', // 默认为 `|`🦖
// 原样构建输出(路径)
staticDirectories: ['static'],
// 引入css样式
// stylesheets: [
// 'https://docusaurus.io/style.css',
// ],
// 引入js
// scripts: [
// 'https://docusaurus.io/script.js',
// ],
// 启用错误提示
baseUrlIssueBanner: true,
// 主题
themes: [
// '@docusaurus/theme-classic',
[
require.resolve("@easyops-cn/docusaurus-search-local"),
{
hashed: true,
// language: ['en', 'zh'],
language: ['zh'],
indexDocs: true,
indexBlog: true,
indexPages: true,
docsRouteBasePath: '/docs',
blogRouteBasePath: '/blog',
docsDir: 'docs',
blogDir: 'blog',
highlightSearchTermsOnTargetPage: true,// 结果高亮
// ignoreFiles: /.*/,// 忽略文件(正则表达式)
translations: {
"search_placeholder": "搜索",
"see_all_results": "查看所有结果",
"no_results": "没有结果。",
"search_results_for": "搜索结果 \"{{ keyword }}\"",
"search_the_documentation": "搜索文档",
"count_documents_found": "{{ count }} 个结果",
"count_documents_found_plural": "{{ count }} 个文档找到",
"no_documents_were_found": "没有找到文档"
}
},
]
],
// 主题配置
themeConfig: ({
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
// SEO优化 元数据
// metadata: [{name: 'keywords', content: 'cooking, blog'}],
metadata: [
{name: 'keywords', content: 'IO0288, Docs, 文档'},
{name: 'description', content: 'IO0288的文档库,基于docusaurus,部署于GitHub Pages'},
],
// This would become <meta name="keywords" content="cooking, blog"> in the generated HTML
navbar: {
title: 'IODocs',
logo: {
alt: 'My Site Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'intro',
position: 'left',
label: '文档',
},
{
to: '/blog',
label: '博客',
position: 'left'
},
// 语言选择
{
type: 'localeDropdown',
position: 'right',
},
{
href: 'https://github.com/IO0288/IODocs',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: '文档',
items: [
{
label: '文档',
to: '/docs/intro',
},
],
},
{
title: '社区',
items: [
// {
// label: 'Stack Overflow',
// href: 'https://stackoverflow.com/questions/tagged/docusaurus',
// },
// {
// label: 'Discord',
// href: 'https://discordapp.com/invite/docusaurus',
// },
{
label: 'Mastodon/Misskey',
href: 'https://hello.io0288.cn/@IO0288',
},
],
},
{
title: '更多',
items: [
{
label: '博客',
// to: '/blog',
href: 'https://blog.io0288.cn',
},
{
label: 'GitHub',
href: 'https://github.com/io0288/IODocs',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} <a href="https://blog.io0288.cn" class="footer__link-item">IO0288</a>, Inc. Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
// 翻译
i18n: {
defaultLocale: 'zh',
// locales: ['zh', 'en'],
locales: ['zh'],
localeConfigs: {
zh: {
label: '中文(简体)',
direction: 'ltr',
htmlLang: 'zh-Hans-CN',// 中华人民共和国大陆简体中文
},
// en: {
// label: 'English',
// direction: 'ltr',
// htmlLang: 'en-US',
// },
},
},
// 插件
plugins: [
[
// PWA支持
'@docusaurus/plugin-pwa',
{
// debug: true,
offlineModeActivationStrategies: [
// 'appInstalled',
// 'standalone',
// 'queryString',
// 'mobile',
'always',
],
pwaHead: [
{
tagName: 'link',
rel: 'icon',
href: '/img/docusaurus.png',
},
{
tagName: 'link',
rel: 'manifest',
href: '/manifest.json',
},
{
tagName: 'meta',
name: 'theme-color',
content: 'rgb(37, 194, 160)',
},
{
tagName: 'meta',
name: 'apple-mobile-web-app-capable',
content: 'yes',
},
{
tagName: 'meta',
name: 'apple-mobile-web-app-status-bar-style',
content: '#000',
},
{
tagName: 'link',
rel: 'apple-touch-icon',
href: '/img/docusaurus.png',
},
{
tagName: 'link',
rel: 'mask-icon',
href: '/img/docusaurus.svg',
color: 'rgb(37, 194, 160)',
},
{
tagName: 'meta',
name: 'msapplication-TileImage',
content: '/img/docusaurus.png',
},
{
tagName: 'meta',
name: 'msapplication-TileColor',
content: '#000',
},
],
},
],
],
// 自定义字段
customFields: {
// image: '',
// keywords: [],
},
};
module.exports = config;