-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
489 lines (469 loc) · 15.3 KB
/
Copy pathdocusaurus.config.js
File metadata and controls
489 lines (469 loc) · 15.3 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
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
// @ts-check
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config
import vClusterTheme from "./src/prism-theme.js";
const __webpack_public_path__ = "/docs/";
import resolveGlob from "resolve-glob";
import remarkVersionTokens from "./plugins/remark-version-tokens.js";
import rehypeStripComments from "./plugins/rehype-strip-comments.js";
const newDocTemplate = `---
title: Your Document Title
sidebar_label: Short Label
description: Brief description of the document
---
Write your content here...
`;
const isNetlifyProduction = process.env.CONTEXT === 'production';
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Tenant cluster management",
tagline: "Manage tenant clusters like a hyperscaler",
url: "https://vcluster.com",
baseUrl: __webpack_public_path__,
organizationName: "loft-sh", // Usually your GitHub org/user name.
projectName: "vcluster-docs", // Usually your repo name.
headTags: [
{
tagName: 'link',
attributes: {
rel: 'icon',
href: '/docs/media/rebranding/vCluster_favicon_docs.svg',
type: 'image/svg+xml',
media: '(prefers-color-scheme: light)',
},
},
{
tagName: 'link',
attributes: {
rel: 'icon',
href: '/docs/media/rebranding/vCluster_favicon_docs_dark.svg',
type: 'image/svg+xml',
media: '(prefers-color-scheme: dark)',
},
},
{
tagName: 'link',
attributes: {
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/icon?family=Material+Icons+Outlined',
},
},
],
onBrokenLinks: "throw",
// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
},
themes: ["@saucelabs/theme-github-codeblock", "@docusaurus/theme-mermaid"],
markdown: {
mermaid: true,
hooks: {
onBrokenMarkdownLinks: "warn",
},
},
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
path: "docs",
routeBasePath: "/",
sidebarPath: require.resolve("./sidebars.js"),
editUrl: "https://github.com/loft-sh/vcluster-docs/edit/main/",
editCurrentVersion: true,
beforeDefaultRemarkPlugins: [
[remarkVersionTokens, { siteDir: __dirname }],
],
lastVersion: "current",
versions: {
current: {
label: "v0.32",
banner: "none",
badge: false,
},
},
},
sitemap: {
changefreq: 'weekly',
priority: 0.5,
ignorePatterns: [
'/tags/**',
'/search',
'/search/**',
'*/page/*',
// Exclude versioned URLs from the sitemap. Unversioned paths (served
// by lastVersion) are the canonical entry points for search engines.
// The matching `noindex,follow` meta tag is emitted by the DocItem
// swizzle at src/theme/DocItem/Layout/index.js. See DOC-1325.
'/vcluster/[0-9]*.[0-9]*.[0-9]*/**',
'/platform/[0-9]*.[0-9]*.[0-9]*/**',
'/vcluster/next/**',
'/platform/next/**',
],
filename: 'sitemap.xml',
createSitemapItems: async (params) => {
const { defaultCreateSitemapItems, ...rest } = params;
const items = await defaultCreateSitemapItems(rest);
// Filter out pagination and any remaining versioned URLs that
// slipped past ignorePatterns. Belt-and-braces: the version regex
// here catches any X.Y.Z path segment under /vcluster/ or /platform/.
const filteredItems = items.filter((item) => {
if (item.url.includes('/page/')) return false;
if (item.url.match(/\/vcluster\/\d+\.\d+\.\d+\//)) return false;
if (item.url.match(/\/platform\/\d+\.\d+\.\d+\//)) return false;
if (item.url.match(/\/vcluster\/next(\/|$)/)) return false;
if (item.url.match(/\/platform\/next(\/|$)/)) return false;
return true;
});
// Landing pages get highest priority; everything else stays
// on the default sitemap priority.
return filteredItems.map((item) => {
if (item.url === 'https://vcluster.com/docs/' ||
item.url === 'https://vcluster.com/docs/vcluster/' ||
item.url === 'https://vcluster.com/docs/platform/') {
return { ...item, priority: 1.0, changefreq: 'daily' };
}
return { ...item, priority: 0.8, changefreq: 'weekly' };
});
},
},
theme: {
customCss: resolveGlob.sync(["./src/css/**/*.scss"]),
},
}),
],
[
"redocusaurus",
{
specs: [
{
spec: "schemas/config-openapi.json",
},
],
theme: {
primaryColor: "#ff6600",
redocOptions: {
hideDownloadButton: false,
disableSearch: true,
colors: {
border: {
dark: "#00bdff",
light: "#00bdff",
},
},
},
},
},
],
],
plugins: [
"docusaurus-plugin-sass",
"plugin-image-zoom",
[
"@signalwire/docusaurus-plugin-llms-txt",
{
content: {
enableLlmsFullTxt: true,
includeDocs: true,
includeBlog: false,
includePages: false,
includeVersionedDocs: false,
excludeRoutes: [
'/search/**',
'/tags/**',
// CLI reference pages are auto-generated --help output; exclude
// individual entries to keep llms.txt under 50K. The pattern
// includes the site baseUrl (`/docs/`) because the signalwire
// plugin matches against the full route path.
'/docs/vcluster/cli/**',
// Aggregate config reference renders to ~380K — well above the
// 100K agent truncation limit. Sub-pages are indexed individually.
'/docs/vcluster/configure/vcluster-yaml$',
// Aggregate sync reference renders to ~161K; sub-pages are indexed.
'/docs/vcluster/configure/vcluster-yaml/sync$',
// Platform API reference renders to ~116K; no sub-pages exist.
// Silent truncation on a dense API reference causes incorrect answers.
'/docs/platform/api/resources/project/templates$',
],
// Emit absolute URLs (https://www.vcluster.com/docs/...) instead of
// site-relative paths. Downstream consumers (R2R RAG, LLM agents)
// surface these links to users in CLI contexts where relative paths
// are not clickable or resolvable. See ENGAI-58.
relativePaths: false,
// Strip React-emitted `<!-- -->` JSX expression markers before the
// HTML→Markdown conversion. Runs at the hast stage, ahead of
// rehype-remark, so comment nodes are gone before mdast is built.
// See DOC-1322.
beforeDefaultRehypePlugins: [rehypeStripComments],
},
siteTitle: 'vCluster Documentation',
siteDescription: 'Documentation for vCluster (virtual Kubernetes clusters) and vCluster Platform (multi-cluster management)',
// Descriptions are disabled to keep llms.txt under the 50K agent
// truncation threshold (~43K savings). Titles carry sufficient signal
// for discovery; full content is available at the linked .md URLs.
enableDescriptions: false,
depth: 2,
},
],
function(context, options) {
return {
name: 'yaml-loader',
configureWebpack() {
return {
module: {
rules: [
{
test: /\.ya?ml$/,
use: 'yaml-loader',
},
],
},
};
},
};
},
[
"@docusaurus/plugin-content-docs",
{
id: "vcluster",
path: "vcluster",
routeBasePath: "vcluster",
sidebarPath: require.resolve("./sidebarsVCluster.js"),
editUrl: ({ versionDocsDirPath, docPath }) =>
`https://github.com/loft-sh/vcluster-docs/edit/main/${versionDocsDirPath}/${docPath}`,
editCurrentVersion: true,
beforeDefaultRemarkPlugins: [
[remarkVersionTokens, { siteDir: __dirname }],
],
lastVersion: "0.35.0",
onlyIncludeVersions: ["current", "0.35.0", "0.34.0", "0.33.0"],
versions: {
current: {
label: "main 🚧",
},
"0.35.0": {
label: "v0.35 Stable",
banner: "none",
badge: true,
},
"0.34.0": {
label: "v0.34",
banner: "none",
badge: true,
},
"0.33.0": {
label: "v0.33",
banner: "none",
badge: true,
},
},
},
],
[
"@docusaurus/plugin-content-docs",
{
id: "platform",
path: "platform",
routeBasePath: "platform",
sidebarPath: require.resolve("./sidebarsPlatform.js"),
editUrl: ({ versionDocsDirPath, docPath }) =>
`https://github.com/loft-sh/vcluster-docs/edit/main/${versionDocsDirPath}/${docPath}`,
editCurrentVersion: true,
beforeDefaultRemarkPlugins: [
[remarkVersionTokens, { siteDir: __dirname }],
],
lastVersion: "4.10.0",
onlyIncludeVersions: ["current", "4.10.0", "4.9.0", "4.8.0", "4.7.0"],
versions: {
current: {
label: "main 🚧",
},
"4.10.0": {
label: "v4.10 Stable",
banner: "none",
badge: true,
},
"4.9.0": {
label: "v4.9",
banner: "none",
badge: true,
},
"4.8.0": {
label: "v4.8",
banner: "none",
badge: true,
},
"4.7.0": {
label: "v4.7",
banner: "none",
badge: true,
},
},
},
],
],
scripts: [
{
src: "https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js",
async: true,
},
...(isNetlifyProduction
? [
{
src: "https://www.googletagmanager.com/gtm.js?id=GTM-KGZ3TLD",
async: true,
},
]
: []),
],
clientModules: [
'./src/client/MermaidPolyfillsClient.js',
'./src/client/ConfigNavigationClient.js',
'./src/client/DetailsClicksClient.js',
],
themeConfig: (
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
{
imageZoom: {
selector: '.markdown img, .intro-card img',
options: {
background: 'rgba(0, 0, 0, 0.8)',
scrollOffset: 0,
}
},
mermaid: {
theme: { light: "default", dark: "dark" },
options: {
flowchart: {
htmlLabels: false,
curve: 'basis'
},
fontSize: 14
},
},
tableOfContents: {
// default is ##, ### so add ####
minHeadingLevel: 2,
maxHeadingLevel: 4,
},
colorMode: {
defaultMode: "light",
disableSwitch: true,
respectPrefersColorScheme: false,
},
navbar: {
title: "",
logo: {
alt: "vCluster",
src: "/media/rebranding/vCluster_horizontal-orange.svg",
height: 36,
},
items: [
// Product tabs
{
to: "/vcluster/",
position: "left",
label: "vCluster",
},
{
to: "/platform/",
position: "left",
label: "vCluster Platform",
},
{
href: "https://www.vnode.com/docs",
label: "vNode",
position: "left",
target: "_blank",
},
{
href: "https://www.vmetal.ai/docs",
label: "vMetal",
position: "left",
target: "_blank",
},
// Right-side items
{
href: "https://www.vcluster.com/blog",
label: "Blog",
position: "right",
target: "_blank",
},
{
href: "https://www.vcluster.com/releases/en/changelog?hideLogo=true&hideMenu=true&theme=dark&embed=true&c=vCluster",
label: "Changelog",
position: "right",
target: "_blank",
},
{
href: "https://slack.loft.sh/",
className: "slack-link",
"aria-label": "Slack",
position: "right",
},
{
href: "https://github.com/loft-sh/vcluster-docs",
className: "github-link",
"aria-label": "GitHub",
position: "right",
},
],
},
algolia: {
appId: "K85RIQNFGF",
apiKey: "7c88fbdab6aea75d67f1f52e41b5d456",
indexName: "vcluster",
placeholder: "Search...",
contextualSearch: true,
searchPagePath: "search",
externalUrlRegex:
"(?:loft\\.sh|platform-v4-[0-9]--vcluster-docs-site\\.netlify\\.app|vnode\\.com|vmetal\\.ai)",
},
footer: {
style: "light",
links: [
{
// Use a non-breaking space to prevent any title from showing
title: "\u00A0",
items: [
{
html: `
<a href="https://github.com/loft-sh/vcluster-docs/new/main/staging?filename=your-doc-name.mdx&value=${encodeURIComponent(newDocTemplate)}" target="_blank" class="footer-create-link" aria-label="Create New Doc">
Create New Doc
</a>
`
}
]
},
],
copyright: `Copyright © ${new Date().getFullYear()}<span class="footer-space-before"><a href="https://www.vcluster.com/">vCluster Labs</a></span><span class="footer-separator">|</span>Documentation released under<span class="footer-space-before"><a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0 1.0 Universal</a></span>.`,
},
prism: {
theme: vClusterTheme,
additionalLanguages: ["bash", "hcl"],
},
announcementBar: {
id: "vcluster-0-35-platform-4-10-release",
content:
'🚀 <strong>New releases: <a href="https://www.vcluster.com/releases/en/changelog?hideLogo=true&hideMenu=true&theme=dark&embed=true&c=vCluster" target="_blank">vCluster Platform 4.10 and vCluster 0.35</a></strong>',
backgroundColor: "#050b24",
textColor: "#ffffff",
isCloseable: true,
},
}
),
// Enable faster features with required v4 flags
future: {
faster: true,
v4: {
removeLegacyPostBuildHeadAttribute: true,
},
},
};
export default config;