-
Notifications
You must be signed in to change notification settings - Fork 0
/
docusaurus.config.ts
291 lines (288 loc) · 8.37 KB
/
docusaurus.config.ts
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
import type { Config } from '@docusaurus/types'
import type * as Preset from '@docusaurus/preset-classic'
import { themes } from 'prism-react-renderer'
import { GiscusConfig } from './src/components/Comment'
import social from './data/social'
const beian = ''
const beian1 = ''
const config: Config = {
title: 'mochi的小站',
url: 'https://blog.mochiworld.cn',
baseUrl: '/',
favicon: 'img/favicon.ico',
organizationName: 'mochi',
projectName: 'blog',
customFields: {
bio: '道阻且长,行则将至',
description:
'是一个由mochi创建的个人博客,主要分享编程开发知识和项目,该网站基于 React 驱动的静态网站生成器 Docusaurus 构建。',
},
themeConfig: {
// announcementBar: {
// id: 'announcementBar-3',
// content: ``,
// },
metadata: [
{
name: 'keywords',
content: 'mochi, mochi',
},
{
name: 'keywords',
content: 'blog, javascript, typescript, node, react, vue, web',
},
{
name: 'keywords',
content: '编程爱好者, Web开发者, 写过爬虫, 学过逆向, 现在主攻ts全栈',
},
],
docs: {
sidebar: {
hideable: true,
},
},
navbar: {
logo: {
alt: 'mochi',
src: 'img/logo.webp',
srcDark: 'img/logo.webp',
},
hideOnScroll: true,
items: [
{
label: '博客',
position: 'right',
to: 'blog',
},
{
label: '项目',
position: 'right',
to: 'project',
},
{
label: '更多',
position: 'right',
items: [
{ label: '归档', to: 'blog/archive' },
{ label: '笔记', to: 'docs/skill' },
{ label: '资源', to: 'resources' },
{ label: '友链', to: 'friends' },
{ label: '工具推荐', to: 'docs/tools' },
],
},
{
type: 'localeDropdown',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: '学习',
items: [
{ label: '博客', to: 'blog' },
{ label: '归档', to: 'blog/archive' },
{ label: '技术笔记', to: 'docs/skill' },
{ label: '实战项目', to: 'project' },
{ label: '前端示例', to: 'https://example.kuizuo.cn' },
],
},
{
title: '社交媒体',
items: [
{ label: '关于我', to: '/about' },
{ label: '隐私协议', to: '/privacy-policy' },
{ label: 'GitHub', href: social.github.href },
// { label: 'Twitter', href: social.twitter.href },
{ label: '掘金', href: social.juejin.href },
// { label: 'Discord', href: social.discord.href },
],
},
{
title: '更多',
items: [
{ label: '友链', position: 'right', to: 'friends' },
{ label: '导航', position: 'right', to: 'resources' },
{
html: `
<a href="https://docusaurus.io/zh-CN/" target="_blank" rel="noreferrer noopener">
<img src="/img/buildwith.png" alt="build with docusaurus" width="120" height="50"/>
<a/>
`,
},
],
},
],
copyright: `
<p style="margin-bottom: 0;"><a href="http://beian.miit.gov.cn/">${beian}</a></p>
<p style="display: inline-flex; align-items: center;"><img style="height:20px;margin-right: 0.5rem;" src="/img/police.png" alt="police" height="20"/><a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=${
beian1.match(/\d+/)?.[0]
}" >${beian1}</a></p>
<p>Copyright © 2020 - PRESENT mochi Built with Docusaurus.</p>
`,
},
algolia: {
appId: 'OAMU9AHLVV',
apiKey: '4edfe6bced10f77f2916dca86a1cf5d8',
indexName: 'mochi',
},
prism: {
theme: themes.oneLight,
darkTheme: themes.oneDark,
additionalLanguages: [
'bash',
'json',
'java',
'python',
'php',
'graphql',
'rust',
'toml',
'protobuf',
],
defaultLanguage: 'javascript',
magicComments: [
{
className: 'theme-code-block-highlighted-line',
line: 'highlight-next-line',
block: { start: 'highlight-start', end: 'highlight-end' },
},
{
className: 'code-block-error-line',
line: 'This will error',
},
],
},
giscus: {
repo: 'OceanLcJ/blog',
repoId: 'R_kgDOLi7qvQ',
category: 'General',
categoryId: 'DIC_kwDOLi7qvc4CeILt',
theme: 'light',
darkTheme: 'dark_dimmed',
} satisfies Partial<GiscusConfig>,
tableOfContents: {
minHeadingLevel: 2,
maxHeadingLevel: 4,
},
liveCodeBlock: { playgroundPosition: 'top' },
zoom: {
selector: '.markdown :not(em) > img',
background: {
light: 'rgb(255, 255, 255)',
dark: 'rgb(50, 50, 50)',
},
},
} satisfies Preset.ThemeConfig,
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
path: 'docs',
sidebarPath: 'sidebars.ts',
},
blog: false,
theme: {
customCss: ['./src/css/custom.scss'],
},
sitemap: {
changefreq: 'weekly',
priority: 0.5,
ignorePatterns: ['/tags/**'],
filename: 'sitemap.xml',
},
gtag: {
trackingID: 'G-S4SD5NXWXF',
anonymizeIP: true,
},
debug: process.env.NODE_ENV === 'development',
} satisfies Preset.Options,
],
],
plugins: [
'docusaurus-plugin-image-zoom',
'docusaurus-plugin-sass',
'@docusaurus/plugin-ideal-image',
['docusaurus-plugin-baidu-tongji', { token: 'f91a15bda7ec05a43959e5a4ee64682b' }],
['@docusaurus/plugin-google-tag-manager', { containerId: 'G-9B70TGKMER' }],
[
'@docusaurus/plugin-pwa',
{
debug: process.env.NODE_ENV === 'development',
offlineModeActivationStrategies: ['appInstalled', 'standalone', 'queryString'],
pwaHead: [
{ tagName: 'link', rel: 'icon', href: '/img/logo.png' },
{ tagName: 'link', rel: 'manifest', href: '/manifest.json' },
{ tagName: 'meta', name: 'theme-color', content: '#12affa' },
],
},
],
[
'./src/plugin/plugin-content-blog', // 为了实现全局 blog 数据,必须改写 plugin-content-blog 插件
{
path: 'blog',
editUrl: ({ locale, blogDirPath, blogPath, permalink }) =>
`https://github.com/OceanLcJ/blog/edit/main/${blogDirPath}/${blogPath}`,
editLocalizedFiles: false,
blogDescription: '代码人生:编织技术与生活的博客之旅',
blogSidebarCount: 10,
blogSidebarTitle: 'Blogs',
postsPerPage: 10,
showReadingTime: true,
readingTime: ({ content, frontMatter, defaultReadingTime }) =>
defaultReadingTime({ content, options: { wordsPerMinute: 300 } }),
feedOptions: {
type: 'all',
title: 'mochi',
copyright: `Copyright © ${new Date().getFullYear()} mochi Built with Docusaurus.<p><a href="http://beian.miit.gov.cn/" class="footer_lin">${beian}</a></p>`,
},
},
],
],
headTags: [
{
tagName: 'meta',
attributes: {
name: 'description',
content: 'mochi的个人博客',
},
},
// 添加Monetag的<meta>标签
{
tagName: 'meta',
attributes: {
name: 'monetag',
content: '5558af5874e960a14c7cbef1a6819114',
},
},
],
stylesheets: [
'https://cdn.jsdelivr.net/npm/misans@4.0.0/lib/Normal/MiSans-Normal.min.css',
'https://cdn.jsdelivr.net/npm/misans@4.0.0/lib/Normal/MiSans-Semibold.min.css',
],
i18n: {
defaultLocale: 'zh-CN',
locales: ['en', 'zh-CN'],
localeConfigs: {
en: {
htmlLang: 'en-GB',
},
},
},
scripts: [
{
src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4753725476914524',
crossorigin: 'anonymous',
},
{
src: 'https://alwingulla.com/88/tag.min.js',
'data-zone': '86339',
async: true,
'data-cfasync': 'false'
},
],
}
export default config