forked from DataLinkDC/dinky
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docusaurus.config.js
331 lines (326 loc) · 14.8 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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const path = require('path');
const versions = require('./versions.json');
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Dinky', //网站标题 | Site title
tagline: 'Dinky 为 Apache Flink 而生,让 Flink SQL 纵享丝滑', // 网站标语 | Tagline for your website
url: 'https://www.dinky.org.cn/', // 网站网址 | Your website's URL
baseUrl: '/', // 站点的相对路径 可将其视为是主机名后的路径 | Path to your website
staticDirectories: ['static/img', 'blog/blog_img'], // 静态文件目录 | Path to static files
// trailingSlash: true, //此选项允许您自定义 URL/链接后是否添加结尾斜杠 | Whether to append a trailing slash to the URL when rendering URLs
onBrokenLinks: 'ignore', // Docusaurus 在检测到无效链接时的行为 | Docusaurus behavior when invalid links are detected -> 类型:'ignore' | 'log' | 'warn' | 'error' | 'throw' |
onBrokenMarkdownLinks: 'warn', // Docusaurus 在检测到无效 Markdown 链接时的行为 | Docusaurus behavior when detecting invalid markdown links -> 类型:'ignore' | 'log' | 'warn' | 'error' | 'throw'
onDuplicateRoutes: 'warn', // Docusaurus 在检测到重复的路由时的行为 | Behavior of docusaurus when duplicate routes are detected -> 类型:'ignore' | 'log' | 'warn' | 'error' | 'throw'
favicon: 'dinky_logo.svg', // 左侧logo | left logo
organizationName: 'DataLinkDC', // 拥有此源的 GitHub 用户或组织。 用于部署命令。 | The GitHub user or organization that owns this source. Command for deployment.
projectName: 'dinky', // GitHub 源的名称。 用于部署命令。 | The name of the GitHub repository. Command for deployment.
deploymentBranch: 'main', // GitHub Pages 的部署分支。 用于部署命令。 | The branch to deploy to GitHub Pages. Command for deployment.
customFields: { // 自定义字段 | Custom fields
structTitle: 'Dinky',
structSubTitle: 'Dinky 为 Apache Flink 而生,让 Flink SQL 纵享丝滑',
// structDescription: custom_fields.structDesc(),
learningMore: 'https://space.bilibili.com/366484959/video',
teaching: 'https://www.bilibili.com/video/BV1SX4y1Y7CB/?spm_id_from=333.337.search-card.all.click&vd_source=e806cc3d8e01f5e39a97787aca3fa3ae'
},
i18n: {
defaultLocale: 'zh',
locales: ['zh'],
path: "i18n",
localeConfigs: {
'zh': {
label: "中文",
direction: 'ltr',
},
'en': {
label: "English",
direction: 'ltr',
},
},
},
themes: [
[
require.resolve("@easyops-cn/docusaurus-search-local"),
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
({
// config url is: https://github.com/easyops-cn/docusaurus-search-local#theme-options
hashed: true,
indexDocs: true,
indexPages: true,
highlightSearchTermsOnTargetPage: false, // Highlight search terms on target page.
explicitSearchResultPath: true,
searchBarPosition: "right",
language: ["zh", "en"],
hideSearchBarWithNoSearchContext: true,
}),
],
],
presets: [
[
'@docusaurus/preset-classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
includeCurrentVersion: true,
lastVersion: '1.1',
versions: {
current: {
label: 'Dev',
path: '/next',
banner: 'unreleased',
},
'1.1': {
label: '1.1',
path: '/1.1',
},
'1.0': {
label: '1.0',
path: '/1.0',
},
0.7: {
label: '0.7',
path: '/0.7',
banner: 'unmaintained',
},
0.6: {
label: '0.6',
path: '/0.6',
banner: 'unmaintained',
},
},
sidebarPath: require.resolve('./sidebars.js'),
sidebarCollapsible: true,
// Please change this to your repo.
editUrl: ({locale, versionDocsDirPath, docPath}) => {
if (locale !== 'zh') {
return `https://github.com/DataLinkDC/dinky/tree/master/docs/i18n/${locale}/${docPath}`;
}
return `https://github.com/DataLinkDC/dinky/tree/master/docs/${versionDocsDirPath}/${docPath}`;
},
},
blog: {
showReadingTime: true, // 展示阅读时间 | show read time
include: ['**/*.{md,mdx}'],
exclude: [
'**/_*.{js,jsx,ts,tsx,md,mdx}',
'**/_*/**',
'**/*.test.{js,jsx,ts,tsx}',
'**/__tests__/**',
],
sortPosts: "descending", // 博客主页分页的排序规则(会根据时间排序) 降序: 'descending' 升序: 'ascending' | Governs the direction of blog post sorting.
postsPerPage: 20, // 博客主页的前{count}篇文章数 | the blog homepage show limit count
readingTime: ({content, frontMatter, defaultReadingTime}) =>
defaultReadingTime({content, options: {wordsPerMinute: 300}}), // 阅读时间 md文件中如果不写 date: 此属性 默认是当前时间
},
theme: {
customCss: require.resolve('./src/css/custom.css'), // 自定义css文件
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// announcementBar: {
// id: 'announcementBar-2', // Increment on change
// content: `⭐️ If you like Dinky , give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/DataLinkDC/dinky">GitHub</a> . Domain name will be migrated soon , The new domain name is <a target="_blank" rel="noopener noreferrer" href="https://www.dinky.org.cn">www.dinky.org.cn</a>`,
// backgroundColor: "#BBDFFF",
// isCloseable: false,
// },
hideOnScroll: false, // 滚动时是否隐藏 | Whether to hide the sidebar on scroll
docs: {
sidebar: {
hideable: true,// 是否隐藏侧边栏 | Whether to hide the sidebar in mobile
autoCollapseCategories: false, // 点击另一个分类时自动折叠当前分类 | Click another category will automatically collapse the current category
}
},
navbar: {
title: 'Dinky',
logo: {
alt: 'Dinky',
src: 'side_dinky.svg',
},
items: [
{
to: '/',
position: 'left',
label: 'home',
activeBaseRegex: `^/$`,
},
{
type: 'docsVersionDropdown',
position: 'left',
dropdownActiveClassDisabled: true,
},
{
to: '/download/download',
position: 'right',
label: 'download',
activeBaseRegex: `/download/`,
},
{
label: 'developer_guide',
to: '/docs/next/developer_guide/contribution/how_contribute',
position: 'right',
items: [
{
label: "how_contribute",
to: "/docs/next/developer_guide/contribution/how_contribute",
},
{
label: "local_debug",
to: "/docs/next/developer_guide/local_debug",
},
],
},
// {
// to: '/blog',
// position: 'right',
// label: 'bolg',
// // activeBaseRegex: `/*/`,
// },
{
type: 'localeDropdown',
position: 'right',
},
{
href: 'https://github.com/DataLinkDC/dinky/issues/884',
label: 'faq',
position: 'right',
},
{
href: 'https://github.com/orgs/DataLinkDC/projects/1',
label: 'roadmap',
position: 'right',
},
{
href: 'https://github.com/DataLinkDC/dinky',
className: 'header-github-link',
position: 'right',
alt: 'Gitlab repository',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'docs',
items: [
{
label: 'doc_home',
to: '/docs/next/get_started/overview',
},
{
label: 'openapi',
to: '/docs/next/openapi/openapi_overview',
},
],
},
{
title: 'community',
items: [
{
label: 'issue',
href: 'https://github.com/DataLinkDC/dinky/issues',
},
{
label: 'pr',
href: 'https://github.com/DataLinkDC/dinky/pulls',
},
],
},
{
title: 'more',
items: [
{
label: 'github',
href: 'https://github.com/DataLinkDC/dinky',
}
],
},
],
logo: {
alt: 'Dinky',
src: 'side_dinky.svg',
width: 100,
height: 30,
},
copyright: `Copyright © ${new Date().getFullYear()} Dinky, Inc. DataLinkDC.<br/>
<a href="https://beian.miit.gov.cn" target="_blank">鲁ICP备20001630号-3</a>`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
plugins: [
'./src/plugin/wwads-plugin.ts',
'docusaurus-plugin-less',
[
'@docusaurus/plugin-content-docs',
{
id: 'download',
path: 'download',
routeBasePath: 'download',
editUrl: ({locale, versionDocsDirPath, docPath}) => {
if (locale !== 'zh') {
return `https://github.com/DataLinkDC/dinky/tree/master/docs/i18n/${locale}/${docPath}`;
}
return `https://github.com/DataLinkDC/dinky/tree/master/docs/${versionDocsDirPath}/${docPath}`;
},
sidebarPath: require.resolve('./sidebars.js'),
},
],
[
'@docusaurus/plugin-ideal-image',
{
quality: 70,
max: 1030, // 最大缩放图片尺寸。
options: {
// 图片加载失败时显示的图片
// 默认的图片加载方式
// 默认的图片加载方式
loadType: 'default',
// 图片加载失败时显示的图片
errorImg: 'Cannot load image',
// 图片加载失败时显示的图片
errorType: 'default',
// 图片加载失败时显示的图片
errorImgType: 'default',
// 图片加载失败时显示的图片
},
min: 640, // 最小缩放图片尺寸。 如果原始值比这还低,会使用原图尺寸。
steps: 2, // 在 min 和 max 之间最多生成的图片数量(包含两端点)
disableInDev: false,
},
]
],
scripts: [
// 统计 pv
{src: 'https://hm.baidu.com/hm.js?7f2b5e6f354b8ae1cdec43ba108936f7', async: true},
{src: 'https://cdn.wwads.cn/js/makemoney.js', async: true},
]
};
module.exports = config;