-
Notifications
You must be signed in to change notification settings - Fork 1
/
docusaurus.config.js
216 lines (203 loc) · 6 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
/**
* Copyright (c) 2017-present, HPCDE lab.
*
*/
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
// See https://docusaurus.io/ for all the possible site configuration options.
const admins = [
{
caption: 'Wang An',
// You will need to prepend the image path with your baseUrl
// if it is not '/', like: '/test-site/img/docusaurus.svg'.
image: 'https://git.hpcer.dev/uploads/-/system/user/avatar/10/avatar.png',
infoLink: 'https://git.hpcer.dev/one',
pinned: true,
},
{
caption: 'Genshen Chu',
image: 'https://secure.gravatar.com/avatar/15520bc606e6177300abacab337a5dc6?s=72&d=identicon',
infoLink: 'https://github.com/genshen',
pinned: true,
},
];
const defaultGitRepo = 'https://git.hpcer.dev/HPCDoc/clusters'
const docGitRepo = process.env.DOC_GIT_REPO ? process.env.DOC_GIT_REPO : defaultGitRepo
// for document edit url, fallback is the same for github and gitlab.
const docEditUrl = process.env.DOC_EDIT_URL ? process.env.DOC_EDIT_URL : docGitRepo + '/blob/master/'
// note: if set process.env.DEPLOY_PATH, it must start and end with '/'.
const siteBaseUrl = process.env.NODE_ENV === 'production' ? (process.env.DEPLOY_PATH ? process.env.DEPLOY_PATH : '/clusters/') : '/'
// config algolia search
const algoliaConfig = process.env.USE_ALGOLIA_SEARCH ? {
appId: "BH4D9OD16A",
apiKey: '0aad5efb2b743c35baf62e3f733d4823',
indexName: 'cluster',
// contextualSearch: true
searchParameters: { 'facetFilters': ['type:content'] }
} : null
const localSearchConfig = process.env.USE_LOCAL_SEARCH ? [
require.resolve("@easyops-cn/docusaurus-search-local"),
{
// ... Your options.
// `hashed` is recommended as long-term-cache of index file is possible.
hashed: true,
// For Docs using Chinese, The `language` is recommended to set to:
// ```
language: ["en", "zh"],
// ```
// When applying `zh` in language, please install `nodejieba` in your project.
},
] : null
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const extraUrl = {
git: 'https://git.hpcer.dev',
hub: 'https://hub.hpcer.dev',
status: 'http://status.hpc.hpcer.dev/zabbix/',
hpcde: 'https://hpcde.github.io',
}
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'HPCer Clusters Document',
tagline: '高性能计算与数据工程实验室集群系统用户手册',
url: 'https://hpcdoc.pages.hpcer.dev',
baseUrl: siteBaseUrl,
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'HPCDE lab', // Usually your GitHub org/user name.
projectName: 'cluster-doc', // Usually your repo name.
customFields: { extraUrl: extraUrl },
scripts: [
{
src: "https://buttons.github.io/buttons.js",
async: true,
defer: true,
}
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: 'HPCer Clusters Document',
logo: {
alt: 'HPCer Clusters Document Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'users/getting-started',
position: 'left',
label: 'User Manual',
},
// {to: 'docs/admin/getting-started', label: 'Admin Docs', position: 'left'},
{ to: '/blog', label: 'Blog', position: 'left' },
{
href: docGitRepo,
label: 'Source on Git',
position: 'right',
},
],
},
algolia: algoliaConfig,
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'User Manual',
to: '/docs/users/getting-started',
},
// {
// label: 'Admin Manual',
// to: 'docs/doc2',
// },
],
},
{
title: 'Community',
items: [
{
label: 'HPCer Git',
href: extraUrl.git,
},
{
label: 'HPCer Hub',
href: extraUrl.hub,
},
{
label: "Cluster Status",
href: extraUrl.status,
}
],
},
{
title: 'More',
items: [
{
label: 'Blog',
to: '/blog',
},
{
label: 'Doc Source on Git',
href: docGitRepo,
},
{
label: 'HPCDE lab',
href: extraUrl.hpcde,
},
{
label: 'Help',
to: 'help',
},
],
},
],
logo: {
alt: 'HPCer cluster',
src: `img/oss_logo.svg`,
href: 'https://hpcde.github.io/',
},
copyright: `Copyright © ${new Date().getFullYear()} HPCDE lab. Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
editUrl: docEditUrl,
showLastUpdateAuthor: true,
showLastUpdateTime: true,
},
blog: {
showReadingTime: true,
// Please change this to your repo.
editUrl: docEditUrl,
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
],
],
};
// apply local search plugin
if (localSearchConfig !== null) {
if (!config.plugins) {
config.plugins = [localSearchConfig]
} else {
config.plugins.push(localSearchConfig)
}
}
module.exports = config;