forked from apache/seatunnel-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
472 lines (456 loc) · 18.7 KB
/
Copy pathdocusaurus.config.js
File metadata and controls
472 lines (456 loc) · 18.7 KB
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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
const versions = require("./versions.json");
const st_web_versions = require("./seatunnel_web_versions.json");
const fs = require("fs");
const path = require("path");
function getVersionHomePage(version) {
const sidebarFile = path.join(
__dirname,
"versioned_sidebars",
`version-${version}-sidebars.json`
);
if (fs.existsSync(sidebarFile)) {
try {
const sidebar = JSON.parse(fs.readFileSync(sidebarFile, "utf8"));
const docs = sidebar.docs || [];
const first = docs[0];
if (typeof first === "string") {
return first;
}
if (first && first.type === "category" && Array.isArray(first.items)) {
for (const item of first.items) {
if (typeof item === "string") {
return item;
}
}
}
} catch (e) {
// fallback to default
}
}
return "about";
}
function listMarkdownFiles(rootDir) {
/** @type {string[]} */
const results = [];
/** @param {string} dir */
function walk(dir) {
const entries = fs.readdirSync(dir, { withFileTypes: true });
for (const entry of entries) {
if (entry.name.startsWith(".")) continue;
const absPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
walk(absPath);
continue;
}
if (!entry.isFile()) continue;
if (!entry.name.endsWith(".md") && !entry.name.endsWith(".mdx")) continue;
results.push(path.relative(rootDir, absPath));
}
}
if (fs.existsSync(rootDir)) {
walk(rootDir);
}
return results;
}
function getZhBlogExcludePatterns() {
const blogRoot = path.join(__dirname, "blog");
const zhRoot = path.join(
__dirname,
"i18n",
"zh-CN",
"docusaurus-plugin-content-blog"
);
const blogFiles = listMarkdownFiles(blogRoot);
const exclude = [];
for (const rel of blogFiles) {
const translatedPath = path.join(zhRoot, rel);
if (!fs.existsSync(translatedPath)) {
exclude.push(rel);
}
}
return exclude;
}
const userCaseRedirects = {
"/blog": ["/user_cases"],
"/blog/tags": ["/user_cases/tags"],
"/blog/The-practice-of-SeaTunnel-in-Vip": [
"/user_cases/The-practice-of-SeaTunnel-in-Vip",
],
"/blog/SeaTunnel 在唯品会的实践": [
"/user_cases/The-practice-of-SeaTunnel-in-Vip",
],
"/blog/tags/vip": ["/user_cases/tags/vip"],
"/blog/tags/唯品会": ["/user_cases/tags/vip"],
"/blog/tags/click-house": ["/user_cases/tags/click-house"],
};
function getDocsEditUrl({ version, versionDocsDirPath, docPath, locale }) {
if (version === "current") {
const sourceLocaleDir = locale === "zh-CN" ? "zh" : "en";
return `https://github.com/apache/seatunnel/edit/dev/docs/${sourceLocaleDir}/${docPath}`;
}
return `https://github.com/apache/seatunnel-website/edit/main/${versionDocsDirPath}/${docPath}`;
}
/** @type {import('@docusaurus/types').Config} */
const config = {
markdown: {
mermaid: true,
},
title: "Apache SeaTunnel",
tagline: "Dinosaurs are cool",
url: "https://seatunnel.apache.org",
baseUrl: "/",
onBrokenLinks: "ignore",
onBrokenMarkdownLinks: "ignore",
favicon: "image/favicon.ico",
organizationName: "Apache SeaTunnel",
projectName: "Apache SeaTunnel",
i18n: {
defaultLocale: "en",
locales: ["en", "zh-CN"],
localeConfigs: {
en: {
label: "English",
direction: "ltr",
},
"zh-CN": {
label: "简体中文",
direction: "ltr",
},
},
},
themes: [
"@docusaurus/theme-mermaid",
[
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",
searchBarShortcutHint: false, // Whether to show keyboard shortcut hint in search bar. Disable it if you need to hide the hint while shortcut is still enabled.
language: ["zh", "en"],
hideSearchBarWithNoSearchContext: true,
}),
],
],
headTags: [
{
tagName: 'script',
attributes: {
type: 'text/javascript',
},
<!-- Matomo -->
innerHTML: `
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setDoNotTrack", true]);
_paq.push(["disableCookies"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.apache.org/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '65']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
`,
},
],
scripts: [
'/js/google_translate_init.js', // Load synchronously first
{
src: 'https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit',
async: true,
},
],
presets: [
[
"classic",
{
docs: {
path: "docs",
routeBasePath: "docs",
sidebarPath: require.resolve("./sidebars.js"),
sidebarCollapsible: true,
editLocalizedFiles: true,
// Current docs are sourced from apache/seatunnel, while historical snapshots stay in this repo.
editUrl: getDocsEditUrl,
versions: {
current: {
path: "",
},
[versions[0]]: {
path: versions[0],
},
},
},
blog: {
showReadingTime: true,
postsPerPage: 100,
blogSidebarCount: "ALL",
exclude:
process.env.DOCUSAURUS_CURRENT_LOCALE === "zh-CN"
? getZhBlogExcludePatterns()
: [],
// Please change this to your repo.
editUrl:
"https://github.com/apache/seatunnel-website/edit/main/",
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
sitemap: {
changefreq: 'daily',
priority: 0.5,
filename: 'sitemap.xml',
ignorePatterns: (() => {
const latestVersion = versions[0];
const oldVersions = versions.filter(version => version !== latestVersion);
const ignorePatterns = oldVersions.map(version => `/docs/${version}/**`);
ignorePatterns.push('/blog/**');
return ignorePatterns;
})()
},
},
],
],
themeConfig: {
docs: {
sidebar: {
hideable: true,
autoCollapseCategories: true,
},
},
announcementBar: {
id: "announcementBar", // Increment on change
content: `<a href="https://github.com/apache/seatunnel" target="_blank" style="display: flex; width: 100%; align-items: center; justify-content: center; margin-left: 4px; text-decoration: none; ">⭐️ If you like Apache SeaTunnel, give it a star on GitHub
<img style="width: 1.2rem; height: 1.2rem; margin-left: 0.4rem;" src="/home/icons/github1.svg"> ⭐️
</a>`,
backgroundColor: "rgb(70, 125, 175, 0.8)",
isCloseable: false,
},
hideOnScroll: false, // Whether to hide the sidebar on scroll
colorMode: {
defaultMode: "dark",
disableSwitch: false,
respectPrefersColorScheme: false,
},
navbar: {
title: "Apache SeaTunnel",
logo: {
alt: "Apache SeaTunnel Logo",
src: "image/logo.png",
},
items: [
{
position: "right",
label: "Docs",
items: [
...versions.slice(0, 5).map((version) => ({
label: version,
to: `docs/${version}/${getVersionHomePage(version)}`
})),
{
label: "Next",
to: "/docs/introduction/about",
},
{
label: "All versions",
to: "/versions/",
},
],
},
{
to: "/download",
position: "right",
label: "Download",
activeBaseRegex: `/download`,
},
{
label: "Community",
position: "right",
to: "/community/contribution_guide/contribute",
},
{
to: "/blog",
label: "Blog",
position: "right",
activeBaseRegex: `/blog`,
},
{
to: "/team",
label: "Team",
position: "right",
activeBaseRegex: `/team`,
},
{
to: "/user",
label: "Users",
position: "right",
activeBaseRegex: `/user/`,
},
{
href: "https://github.com/apache/seatunnel",
label: "GitHub",
position: "right",
},
{
to: "/security",
label: "Security",
position: "right",
activeBaseRegex: `/security`,
},
{
type: "localeDropdown",
position: "right",
},
],
},
footer: {
links: [
{
title: "SeaTunnel",
items: [
{
label: "FAQ",
href: "/docs/faq",
},
{
label: "Releases",
href: "https://github.com/apache/seatunnel/releases",
},
],
},
{
title: "Community",
items: [
{
label: "GitHub",
href: "https://github.com/apache/seatunnel",
},
{
label: "Issue Tracker",
href: "https://github.com/apache/seatunnel/issues",
},
{
label: "Pull Requests",
href: "https://github.com/apache/seatunnel/pulls",
},
],
},
{
title: "ASF",
items: [
{
label: "Foundation",
href: "https://www.apache.org/",
},
{
label: "License",
href: "https://www.apache.org/licenses/",
},
{
label: "Events",
href: "https://www.apache.org/events/current-event",
},
{
label: "Sponsorship",
href: "https://www.apache.org/foundation/sponsorship.html",
},
{
label: "Thanks",
href: "https://www.apache.org/foundation/thanks.html",
},
{
label: "Privacy",
href: "https://apache.org/foundation/policies/privacy.html",
},
],
},
{
title: "Subscribe Mailing List",
items: [
{
label: "How to Subscribe",
to: "/community/contribution_guide/subscribe",
},
{
label: "Subscribe Mail",
href: "mailto:dev-subscribe@seatunnel.apache.org",
},
{
label: "Mail Archive",
href: "https://lists.apache.org/list.html?dev@seatunnel.apache.org",
},
],
},
],
copyright: `
<div style="margin-top: 20px;">
<div style="min-height: 60px;line-height: 20px;text-align: center;font-family: Avenir-Medium;font-size: 14px;color: #999;display: flex;align-items: center;justify-content: center;"><span>Copyright © 2021-${new Date().getFullYear()} The Apache Software Foundation. Apache SeaTunnel and its feather logo are trademarks of The Apache Software Foundation.</span></div>
<div style="text-align: center;">
<a href="https://twitter.com/asfseatunnel?s=21" target="_blank" title="Twitter" ><svg t="1644553365083" class="icon" viewBox="0 0 1260 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7015" width="38" height="38"><path d="M1259.846921 121.148242c-46.524504 20.728739-96.273478 34.547899-148.325646 40.536201 53.434084-31.784067 94.430924-82.454319 113.777747-142.797982-50.209613 29.480874-105.486251 51.13089-164.447999 62.646857A257.584528 257.584528 0 0 0 872.449815 0.000276c-142.797982 0-258.418284 115.620302-258.418284 258.418284 0 20.268101 2.303193 40.075563 6.909579 58.961748C405.82286 306.32498 215.579097 203.602561 87.98219 47.446058c-22.110655 38.233008-35.008538 82.454319-35.008538 129.900099 0 89.824537 45.603227 168.593747 115.159663 215.118251-42.378756-1.381916-81.99368-12.897882-117.002217-32.244706v3.224471c0 125.293713 88.90326 229.398049 207.287393 253.351259-21.650017 5.988302-44.681949 9.212773-68.17452 9.212773-16.582991 0-32.705344-1.842555-48.827697-4.606387 32.705344 102.722419 128.518184 177.345881 241.374653 179.649074-88.442621 69.095798-199.917175 110.553277-321.06514 110.553277-20.728739 0-41.457479-1.381916-61.72558-3.685109 114.238386 73.241546 250.126788 116.08094 396.149241 116.08094 475.379089 0 735.179289-393.846048 735.179289-735.179289 0-11.055328-0.460639-22.571294-0.921277-33.626621 51.13089-36.851092 94.891562-82.454319 129.439461-134.045848z" fill="#909094" p-id="7016"></path></svg></a>
<a href="https://s.apache.org/seatunnel-slack" target="_blank" title="Slack" style="margin-left: 20px;"><svg t="1644553076784" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3088" width="36" height="36"><path d="M215.125333 647.04a107.861333 107.861333 0 0 1-107.52 107.648A107.861333 107.861333 0 0 1 0 647.04a107.818667 107.818667 0 0 1 107.605333-107.52h107.52v107.52z m54.229334 0a107.818667 107.818667 0 0 1 107.562666-107.52 107.818667 107.818667 0 0 1 107.562667 107.52v269.354667A107.861333 107.861333 0 0 1 376.917333 1024a107.861333 107.861333 0 0 1-107.562666-107.605333v-269.354667zM376.917333 215.125333a107.861333 107.861333 0 0 1-107.562666-107.52A107.861333 107.861333 0 0 1 376.917333 0a107.861333 107.861333 0 0 1 107.562667 107.605333v107.52H376.917333z m0 54.229334a107.861333 107.861333 0 0 1 107.562667 107.562666 107.861333 107.861333 0 0 1-107.562667 107.562667H107.605333A107.861333 107.861333 0 0 1 0 376.917333a107.861333 107.861333 0 0 1 107.605333-107.562666h269.312z m431.872 107.562666a107.861333 107.861333 0 0 1 107.605334-107.562666A107.861333 107.861333 0 0 1 1024 376.917333a107.861333 107.861333 0 0 1-107.605333 107.562667h-107.605334V376.917333z m-54.101333 0a107.861333 107.861333 0 0 1-107.648 107.562667 107.818667 107.818667 0 0 1-107.52-107.562667V107.605333A107.818667 107.818667 0 0 1 647.04 0a107.861333 107.861333 0 0 1 107.648 107.605333v269.312z m-107.648 431.872a107.861333 107.861333 0 0 1 107.648 107.605334A107.861333 107.861333 0 0 1 647.04 1024a107.818667 107.818667 0 0 1-107.52-107.605333v-107.605334h107.52z m0-54.101333a107.818667 107.818667 0 0 1-107.52-107.648 107.776 107.776 0 0 1 107.52-107.52h269.354667A107.818667 107.818667 0 0 1 1024 647.04a107.861333 107.861333 0 0 1-107.605333 107.648h-269.354667z" p-id="3089" fill="#909094"></path></svg></a>
<a href="https://lists.apache.org/list.html?dev@seatunnel.apache.org" target="_blank" title="Mailing list" style="margin-left: 20px;"><svg t="1644553175467" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5304" width="39" height="39"><path d="M853.333333 170.666667H170.666667c-46.933333 0-85.333333 38.4-85.333334 85.333333v512c0 46.933333 38.4 85.333333 85.333334 85.333333h682.666666c46.933333 0 85.333333-38.4 85.333334-85.333333V256c0-46.933333-38.4-85.333333-85.333334-85.333333z m0 170.666666l-341.333333 213.333334-341.333333-213.333334V256l341.333333 213.333333 341.333333-213.333333v85.333333z" p-id="5305" fill="#909094"></path></svg></a>
<a href="https://github.com/apache/seatunnel" target="_blank" title="GitHub" style="margin-left: 20px;"><svg t="1644553223000" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6156" width="36" height="36"><path d="M512 12.64c-282.752 0-512 229.216-512 512 0 226.208 146.72 418.144 350.144 485.824 25.6 4.736 35.008-11.104 35.008-24.64 0-12.192-0.48-52.544-0.704-95.328-142.464 30.976-172.512-60.416-172.512-60.416-23.296-59.168-56.832-74.912-56.832-74.912-46.464-31.776 3.52-31.136 3.52-31.136 51.392 3.616 78.464 52.768 78.464 52.768 45.664 78.272 119.776 55.648 148.992 42.56 4.576-33.088 17.856-55.68 32.512-68.48-113.728-12.928-233.28-56.864-233.28-253.024 0-55.904 20-101.568 52.768-137.44-5.312-12.896-22.848-64.96 4.96-135.488 0 0 43.008-13.76 140.832 52.48a491.296 491.296 0 0 1 128.16-17.248c43.488 0.192 87.328 5.888 128.256 17.248 97.728-66.24 140.64-52.48 140.64-52.48 27.872 70.528 10.336 122.592 5.024 135.488 32.832 35.84 52.704 81.536 52.704 137.44 0 196.64-119.776 239.936-233.792 252.64 18.368 15.904 34.72 47.04 34.72 94.816 0 68.512-0.608 123.648-0.608 140.512 0 13.632 9.216 29.6 35.168 24.576C877.472 942.624 1024 750.784 1024 524.64c0-282.784-229.248-512-512-512z" p-id="6157" fill="#909094"></path></svg></a>
</div>
<div>`,
},
prism: {
theme: require("prism-react-renderer/themes/dracula"),
darkTheme: darkCodeTheme,
},
},
plugins: [
"docusaurus-plugin-less",
[
"@docusaurus/plugin-content-docs",
{
id: "seatunnel_web",
path: "seatunnel_web",
routeBasePath: "seatunnel_web",
sidebarCollapsible: true,
editLocalizedFiles: true,
// Please change this to your repo.
editUrl:
"https://github.com/apache/seatunnel-website/edit/main/",
versions: {
[st_web_versions[0]]: {
path: st_web_versions[0],
},
},
sidebarPath: require.resolve("./sidebarsSeaTunnelWeb.js"),
},
],
[
"@docusaurus/plugin-content-docs",
{
id: "community",
path: "community",
routeBasePath: "community",
editUrl: ({ locale, versionDocsDirPath, docPath }) => {
if (locale !== "en") {
return `https://github.com/apache/seatunnel-website/edit/main/i18n/${locale}/${docPath}`;
}
return `https://github.com/apache/seatunnel-website/edit/main/${versionDocsDirPath}/${docPath}`;
},
sidebarPath: require.resolve("./sidebarsCommunity.js"),
},
],
[
"@docusaurus/plugin-client-redirects",
{
createRedirects(existingPath) {
return userCaseRedirects[existingPath] || [];
},
},
],
],
};
module.exports = config;