forked from hhk7734/wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocusaurus.config.js
132 lines (123 loc) · 3.48 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
const path = require("path");
const _fs = require("fs");
const remarkMath = require("remark-math");
const rehypeKatex = require("rehype-katex");
module.exports = {
title: "loliot",
tagline: "loliot",
url: "https://wiki.loliot.net",
baseUrl: "/",
favicon: "img/favicon.ico",
organizationName: "HandS",
projectName: "wiki.loliot.net",
plugins: [
"@docusaurus/plugin-google-analytics",
"docusaurus-plugin-google-adsense",
],
themeConfig: {
googleAnalytics: {
trackingID: "UA-82937088-4",
anonymizeIP: true,
},
googleAdsense: {
dataAdClient: "ca-pub-5199357432848758",
},
defaultDarkMode: true,
algolia: {
apiKey: "882821d106ded887254b7b5ec5690c5b",
indexName: "liliot_wiki",
},
navbar: {
title: "loliot",
logo: {
alt: "loliot Logo",
src: "img/logo.svg",
},
links: (() => {
const links = [];
const sidebarConfig = require("./sidebars");
const labelDic = {
arduino: "Arduino",
avr: "AVR",
cpp: "C++",
circuit: "Circuit",
"debian-package": "Debian package",
etc: "Etc",
flutter: "Flutter",
infineon: "Infineon",
labview: "LabVIEW",
lang: "Programming",
linux: "Linux",
"linux-kernel": "Linux kernel",
"linux-tools": "Linux tools",
mcu: "MCU",
memo: "Memo",
nodejs: "Node.js",
project: "Project",
python: "Python",
};
_fs
.readdirSync(path.join(path.dirname(__filename), "docs"))
.map((rootDir) => {
// rootDir => /docs/lang, /docs/mcu, ...
const link = {
label: labelDic[rootDir],
position: "left",
items: [],
};
_fs
.readdirSync(path.join(path.dirname(__filename), "docs", rootDir))
.map((subDir, subIndex) => {
// subDir => /docs/lang/cpp, /docs/mcu/infineon, ...
link.items.push({
label: labelDic[subDir],
to: "",
});
// sub link
let linkPath;
let item = sidebarConfig[subDir][0];
while (typeof item === "object") {
item = item["items"][0];
}
linkPath = `/docs/${item}`;
link.items[subIndex]["to"] = linkPath;
// root link == first sub link
if (subIndex === 0) link["to"] = linkPath;
});
links.push(link);
});
links.push({
href: "https://github.com/hhk7734/wiki.loliot.net",
label: "GitHub",
position: "right",
});
return links;
})(),
},
footer: {
style: "dark",
copyright: `Copyright © ${new Date().getFullYear()} HandS. Built with Docusaurus.`,
},
},
presets: [
[
"@docusaurus/preset-classic",
{
docs: {
sidebarPath: require.resolve("./sidebars.js"),
showLastUpdateTime: true,
remarkPlugins: [remarkMath],
rehypePlugins: [[rehypeKatex, {strict: false}]],
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
sitemap: {
cacheTime: 600 * 1000, // 600 sec - cache purge period
changefreq: "weekly",
priority: 0.5,
},
},
],
],
};