-
Notifications
You must be signed in to change notification settings - Fork 10
/
docusaurus.config.js
208 lines (203 loc) · 5.54 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
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
const math = require("remark-math");
const katex = require("rehype-katex");
const path = require("path");
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "icodex",
tagline: "frontend development cookbook",
url: "https://icodex.me",
baseUrl: "/",
deploymentBranch: "gh-pages",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.ico",
organizationName: "wood3n",
projectName: "icodex-next",
plugins: [
"@docusaurus/theme-live-codeblock",
path.resolve(__dirname, "./src/plugins/webpackConfig.js"),
],
stylesheets: [
{
href: "https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css",
integrity:
"sha384-Um5gpz1odJg5Z4HAmzPtgZKdTBHZdw8S29IecapCSB31ligYPhHQZMIlWLYQGVoc",
crossorigin: "anonymous",
},
],
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
pages: {
path: "src/pages",
// 指定 pages 的路由路径,因为 blog 作为主页了
routeBasePath: "/pages",
},
docs: {
sidebarPath: require.resolve("./sidebars.js"),
remarkPlugins: [math],
rehypePlugins: [katex],
editUrl: ({ docPath }) => {
return `https://github.com/wood3n/icodex-next/tree/master/docs/${docPath}`;
},
},
blog: {
// blog作为主页
routeBasePath: "/",
path: "./blog",
showReadingTime: true,
readingTime: ({ content, defaultReadingTime }) =>
defaultReadingTime({ content, options: { wordsPerMinute: 100 } }),
blogSidebarCount: 20,
blogSidebarTitle: "Recent posts",
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
gtag: {
trackingID: "UA-153188913-1",
anonymizeIP: true,
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
{
docs: {
sidebar: {
hideable: true,
},
},
metadata: [
{
name: "keywords",
content:
"frontend, react, javascript, css, react, vue, typescript, docusaurus, blog, personal blog, personal website",
},
],
// 开启 algolia
algolia: {
// If Algolia did not provide you any appId, use 'BH4D9OD16A'
appId: "GMKEEJO8X4",
// Public API key: it is safe to commit it
apiKey: "0ccd259970e3e65b1df2f83c4ddd3e8b",
indexName: "icodex",
},
navbar: {
title: "icodex",
hideOnScroll: true,
logo: {
alt: "icodex",
src: "img/logo.png",
},
items: [
{
type: "search",
position: "right",
},
{ to: "/pages/project", label: "My Project", position: "right" },
{
type: "dropdown",
label: "Skill",
position: "right",
items: [
{
type: "doc",
label: "JavaScript",
docId: "javascript/index",
},
{
type: "doc",
label: "CSS",
docId: "css/index",
},
{
// type: "doc",
label: "TypeScript",
to: "docs/typescript",
},
{
type: "doc",
label: "React",
docId: "react/index",
},
{
type: "doc",
label: "NodeJS",
docId: "nodejs/awesome-nodejs",
},
// {
// type: "doc",
// label: "Engineer",
// docId: "engineer/index",
// },
],
},
{
type: "dropdown",
label: "Learn",
position: "right",
items: [
{
type: "doc",
label: "Network",
docId: "network/index",
},
{
type: "doc",
label: "Algorithm",
docId: "algorithm/算法分析",
},
{
type: "doc",
label: "Interview",
docId: "interview/index",
},
],
},
{
type: "doc",
label: "Engineer",
position: "right",
docId: "engineer/index",
},
{
type: "doc",
label: "Tool",
position: "right",
docId: "tools/git",
},
{
href: "https://github.com/wood3n/icodex-next",
position: "right",
// custom logo in custom.css
className: "header-github-link",
"aria-label": "GitHub repository",
},
],
},
liveCodeBlock: {
/**
* The position of the live playground, above or under the editor
* Possible values: "top" | "bottom"
*/
playgroundPosition: "bottom",
},
prism: {
theme: darkCodeTheme,
darkTheme: darkCodeTheme,
defaultLanguage: "javascript",
},
},
i18n: {
defaultLocale: "zh-CN",
locales: ["zh-CN"],
},
};
module.exports = config;