forked from wasmCloud/wasmcloud.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocusaurus.config.ts
More file actions
662 lines (637 loc) · 24.3 KB
/
Copy pathdocusaurus.config.ts
File metadata and controls
662 lines (637 loc) · 24.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
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
import fs from 'node:fs/promises';
import { Config } from '@docusaurus/types';
import {
Options as PresetClassicOptions,
ThemeConfig as PresetClassicThemeConfig,
} from '@docusaurus/preset-classic';
import { Options as PluginContentBlogOptions } from '@docusaurus/plugin-content-blog';
import { Options as PluginGoogleAnalyticsOptions } from '@docusaurus/plugin-google-analytics';
import { Options as PluginGoogleTagManagerOptions } from '@docusaurus/plugin-google-tag-manager';
import { Options as PluginGithubStarsOptions } from '@wasmcloud/docusaurus-github-stars';
import { Options as PluginHubspotAnalyticsOptions } from '@wasmcloud/docusaurus-hubspot-analytics';
import { Options as PluginReoAnalyticsOptions } from '@wasmcloud/docusaurus-reo-analytics';
import { Options as PluginSEOChecksOptions } from '@wasmcloud/docusaurus-seo-checks';
import communitySpeakersPlugin from './plugins/community-speakers';
import peoplePagesPlugin from './plugins/people-pages';
import transcriptInheritancePlugin from './plugins/transcript-inheritance';
import rehypeShiki, { RehypeShikiOptions } from '@shikijs/rehype';
import {
transformerMetaHighlight,
transformerNotationDiff,
transformerNotationHighlight,
transformerNotationFocus,
} from '@shikijs/transformers';
import rehypeNameToId from 'rehype-name-to-id';
import { WASMCLOUD_VERSION } from './src/wasmcloud-version';
import wasmCloudVersionPlugin from './src/remark/wasmcloud-version';
// When OFFLINE_BUILD=1 (used by the `docs-v*` release workflow that builds the
// air-gapped container image and tarball), skip every plugin and head tag that
// would cause an air-gapped browser to call out — analytics, search, fonts —
// and trim the build to the current docs version only.
const offlineBuild = process.env.OFFLINE_BUILD === '1';
const rehypeShikiPlugin = [
rehypeShiki,
{
themes: {
dark: 'github-dark',
light: 'github-light',
},
transformers: [
{
name: 'meta',
code(node) {
const language = this.options.lang ?? 'plaintext';
this.addClassToHast(node, `language-${language}`);
return node;
},
},
transformerMetaHighlight(),
transformerNotationDiff(),
transformerNotationHighlight(),
transformerNotationFocus(),
],
} as RehypeShikiOptions,
];
function siteBaseUrl() {
if (process.env.NODE_ENV === 'development') {
return 'http://localhost:3000';
}
if (
process.env.NETLIFY &&
process.env.CONTEXT === 'deploy-preview' &&
process.env.DEPLOY_PRIME_URL
) {
return process.env.DEPLOY_PRIME_URL;
}
return 'https://wasmcloud.com';
}
const config = (async (): Promise<Config> => {
return {
title: 'wasmCloud',
tagline: 'Build applications in any language. Deploy them anywhere.',
customFields: {
description: 'The secure, distributed, WebAssembly application platform',
tagline_1: 'Build applications in any language.',
tagline_2: 'Deploy them anywhere.',
},
future: {
experimental_faster: true,
v4: true,
},
url: siteBaseUrl(),
baseUrl: '/',
trailingSlash: true,
// Offline build excludes v1 / 0.82 docs; links from current → those
// versions become unresolvable, so downgrade to warn for this build path
// only. The production build keeps the throw behavior.
onBrokenLinks: offlineBuild ? 'warn' : 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: '/favicon.ico',
// Even if you don't use internalization, 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'],
},
presets: [
[
'classic',
{
blog: {
blogTitle: 'Blog',
blogDescription: 'The latest wasmCloud news, updates, and announcements.',
blogSidebarCount: 0,
beforeDefaultRehypePlugins: [rehypeShikiPlugin],
rehypePlugins: [rehypeNameToId],
authorsMapPath: '../authors.yml', // relative to blog directory
blogListComponent: '@theme/wasmcloud/blog/list-page',
blogPostComponent: '@theme/wasmcloud/blog/post-page',
onInlineAuthors: 'throw',
onUntruncatedBlogPosts: 'ignore',
// M1 — populate metadata.lastUpdatedAt + lastUpdatedBy from git so
// downstream Article schema can emit dateModified accurately.
showLastUpdateTime: true,
showLastUpdateAuthor: true,
},
docs: {
sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/wasmCloud/wasmcloud.com/edit/main/',
remarkPlugins: [[wasmCloudVersionPlugin, { version: WASMCLOUD_VERSION }]],
beforeDefaultRehypePlugins: [rehypeShikiPlugin],
rehypePlugins: [rehypeNameToId],
// M1 — same as blog: drives TechArticle.dateModified
showLastUpdateTime: true,
showLastUpdateAuthor: true,
lastVersion: 'current',
// Air-gapped image only ships the current (v2) docs; v1 and 0.82
// are skipped to keep image size sane.
...(offlineBuild ? { onlyIncludeVersions: ['current'] } : {}),
versions: {
current: {
label: 'v2',
},
v1: {
label: 'v1',
path: 'v1',
},
0.82: {
label: '0.82',
path: '0.82',
banner: 'unmaintained',
},
},
},
pages: {
beforeDefaultRehypePlugins: [rehypeShikiPlugin],
rehypePlugins: [rehypeNameToId],
},
sitemap: {
// Emit a per-URL <lastmod> (YYYY-MM-DD). This is the freshness
// signal search engines actually act on for crawl scheduling and
// discovery of new/updated pages (priority/changefreq are weak
// hints). Defaults to null in the plugin, so it must be set.
lastmod: 'date',
changefreq: 'weekly',
priority: 0.5,
filename: 'sitemap.xml',
createSitemapItems: async (params) => {
const { defaultCreateSitemapItems, ...rest } = params;
const items = await defaultCreateSitemapItems(rest);
const COMMUNITY_YEAR_RE = /^\/community\/(\d{4})[-/]/;
// Low-value utility / auto-generated pages with no SEO value — keep out of the sitemap
const SITEMAP_DROP_EXACT = new Set([
'/search/',
'/blog/authors/',
'/blog/archive/',
'/community/authors/',
'/community/archive/',
'/gather/',
'/feedback/backstage/',
]);
return items.flatMap((item) => {
// Use pathname so priorities work on deploy previews too
const path = new URL(item.url).pathname;
const normPath = path.endsWith('/') ? path : `${path}/`;
if (
SITEMAP_DROP_EXACT.has(normPath) ||
normPath.startsWith('/blog/authors/') ||
normPath.startsWith('/community/authors/')
) {
return [];
}
// Community meeting/transcript dated content:
// 2026 → priority 0.9 (current cadence)
// 2025 → priority 0.8 (indexed; content-rich backfilled pages)
// pre-2025 → noindex (handled in CommunityPostPage swizzle); drop from sitemap
const communityYearMatch = path.match(COMMUNITY_YEAR_RE);
if (communityYearMatch) {
const year = Number(communityYearMatch[1]);
if (year >= 2026) {
return [{ ...item, priority: 0.9, changefreq: 'monthly' }];
}
if (year >= 2025) {
return [{ ...item, priority: 0.8, changefreq: 'yearly' }];
}
return [];
}
// Homepage — highest priority
if (path === '/') {
return { ...item, priority: 1.0, changefreq: 'daily' };
}
// v2 docs (current, no version prefix) — high priority
if (path.startsWith('/docs/') && !path.startsWith('/docs/v1/') && !path.startsWith('/docs/0.82/')) {
// Docs landing — top priority alongside homepage
if (path === '/docs/') {
return { ...item, priority: 1.0, changefreq: 'weekly' };
}
// SEO-critical: component model, kubernetes, quickstart, overview
if (
path.startsWith('/docs/quickstart/') ||
path.startsWith('/docs/overview/') ||
path.startsWith('/docs/kubernetes-operator/')
) {
return { ...item, priority: 0.9, changefreq: 'weekly' };
}
return { ...item, priority: 0.8, changefreq: 'weekly' };
}
// Blog posts — high priority
if (path.startsWith('/blog/') || path === '/blog/') {
if (path === '/blog/' || path === '/blog') {
return { ...item, priority: 0.8, changefreq: 'daily' };
}
// Pagination & tag archives — thin, paginated, near-duplicate
// listing pages with no standalone ranking value. Keep them
// out of the sitemap so crawl budget goes to real content.
if (path.startsWith('/blog/page/') || path.startsWith('/blog/tags/')) {
return [];
}
return { ...item, priority: 0.7, changefreq: 'monthly' };
}
// People profile pages — high priority (people the
// project wants surfaced in search). Index slightly
// higher than the per-profile pages.
if (path === '/people/') {
return { ...item, priority: 0.8, changefreq: 'monthly' };
}
if (path.startsWith('/people/')) {
return { ...item, priority: 0.7, changefreq: 'monthly' };
}
// Community meeting notes & transcripts
if (path.startsWith('/community/') || path === '/community/') {
if (path === '/community/' || path === '/community') {
return { ...item, priority: 0.7, changefreq: 'monthly' };
}
// Pagination & tag archives — thin listing pages, dropped
// from the sitemap (see blog section above).
if (path.startsWith('/community/page/') || path.startsWith('/community/tags/')) {
return [];
}
// Individual meeting notes & transcripts
return { ...item, priority: 0.5, changefreq: 'monthly' };
}
// v1 docs — archived. High-value pages that still hold rankings
// stay crawlable until a v2 successor inherits them; the rest stay low.
if (path.startsWith('/docs/v1/')) {
const STILL_RANKING_V1 = new Set([
'/docs/v1/kubernetes',
'/docs/v1/intro',
'/docs/v1/concepts',
'/docs/v1/concepts/lattice',
'/docs/v1/concepts/components',
'/docs/v1/ecosystem/wadm',
'/docs/v1/ecosystem/wasmtime',
'/docs/v1/deployment/nats/cluster-config',
]);
const norm = path.replace(/\/$/, '');
if (STILL_RANKING_V1.has(norm)) {
return { ...item, priority: 0.6, changefreq: 'monthly' };
}
return { ...item, priority: 0.3, changefreq: 'monthly' };
}
// 0.82 docs — disallowed in robots.txt, so they must NOT be in
// the sitemap: listing a robots-blocked URL is a contradictory
// signal that Search Console flags. Drop them entirely.
if (path.startsWith('/docs/0.82/')) {
return [];
}
// Everything else (standalone pages like /contact, etc.)
return { ...item, priority: 0.5, changefreq: 'monthly' };
});
},
},
theme: {
customCss: [require.resolve('./src/styles/index.css')],
},
} satisfies PresetClassicOptions,
],
],
plugins: [
communitySpeakersPlugin,
peoplePagesPlugin,
transcriptInheritancePlugin,
[
'@wasmcloud/docusaurus-github-stars',
{
preloadRepo: process.env.NODE_ENV === 'production' ? 'wasmCloud/wasmCloud' : undefined,
} satisfies PluginGithubStarsOptions,
],
[
'@wasmcloud/docusaurus-seo-checks',
{
underscores: { level: 'error' },
} satisfies PluginSEOChecksOptions,
],
[
'@docusaurus/plugin-content-blog',
{
id: 'community',
routeBasePath: 'community',
path: './community',
showReadingTime: false,
editUrl: 'https://github.com/wasmCloud/wasmcloud.com-dev/edit/main/',
blogTitle: 'Community Calls',
blogDescription: 'Weekly wasmCloud Wednesday agendas, notes, and recordings.',
blogSidebarCount: 'ALL',
blogSidebarTitle: 'Past Meetings',
beforeDefaultRehypePlugins: [rehypeShikiPlugin],
rehypePlugins: [rehypeNameToId],
authorsMapPath: '../authors.yml', // relative to community directory
blogListComponent: '@theme/wasmcloud/community/list-page',
blogPostComponent: '@theme/wasmcloud/community/post-page',
onInlineAuthors: 'ignore',
onUntruncatedBlogPosts: 'ignore',
} satisfies PluginContentBlogOptions,
],
...(offlineBuild
? []
: [
[
'@docusaurus/plugin-google-tag-manager',
{
containerId: process.env.GTM_CONTAINER_ID || 'localdev',
} satisfies PluginGoogleTagManagerOptions,
],
[
'@docusaurus/plugin-google-analytics',
{
trackingID: process.env.GOOGLE_ANALYTICS_ID || 'localdev',
anonymizeIP: true,
} satisfies PluginGoogleAnalyticsOptions,
],
[
'@wasmcloud/docusaurus-hubspot-analytics',
{
hubspotId: process.env.HUBSPOT_ID || 'localdev',
} satisfies PluginHubspotAnalyticsOptions,
],
[
'@wasmcloud/docusaurus-reo-analytics',
{
clientID: process.env.REO_CLIENT_ID || 'localdev',
} satisfies PluginReoAnalyticsOptions,
],
]),
customPostCssPlugin, // PostCSS plugin function registration
[
'docusaurus-plugin-llms',
{
generateLlmsTxt: true,
generateLlmsFullTxt: true,
docsPluginIds: ['default'],
blogPluginIds: ['default'],
},
],
],
themeConfig: {
image: '/logo/wasmcloud-social.png',
metadata: [
{ property: 'og:type', content: 'website' },
{ name: 'twitter:site', content: '@wasmcloud' },
],
navbar: {
title: 'wasmCloud',
logo: {
alt: 'wasmCloud Logo',
src: '/logo/wasmcloud_green.svg',
},
items: [
{ to: '/blog', label: 'Blog', position: 'left' },
{ to: '/community', label: 'Community', position: 'left' },
{ type: 'doc', docId: 'index', position: 'left', label: 'Docs' },
{
type: 'docsVersionDropdown',
// used for styling, see src/styles/theme/_navbar.css
className: 'navbar__link--version-dropdown',
},
// The <github-count> custom element fetches api.github.com at runtime
// to populate the live star count. Dropped in offline builds so
// air-gapped browsers do not attempt that request.
...(offlineBuild
? []
: [
{
href: 'https://github.com/wasmcloud/wasmcloud',
'aria-label': 'Star wasmCloud on GitHub',
position: 'right' as const,
html: `<span class="badge badge--outline">Star us! ★ <github-count repo="wasmcloud/wasmcloud">1500</github-count></span>`,
className: 'sidebar-hidden',
},
]),
await svgIconNavItem({
svgIconPath: './static/icons/github.svg',
label: 'GitHub',
href: 'https://github.com/wasmcloud/wasmcloud',
}),
await svgIconNavItem({
svgIconPath: './static/icons/slack.svg',
label: 'Slack',
href: 'https://slack.wasmcloud.com/',
}),
],
},
// announcementBar: {
// id: 'announcement',
// content: `📢 Announcement content goes here.`,
// },
footer: {
links: [
{
title: 'Community',
items: [
{
label: 'GitHub',
href: 'https://github.com/wasmcloud/',
},
{
label: 'Contributing',
href: 'https://github.com/wasmCloud/wasmCloud/blob/main/CONTRIBUTING.md',
},
{
label: 'Slack',
href: 'https://slack.wasmcloud.com',
},
{
label: 'Calendar & wasmCloud Wednesdays',
href: 'https://calendar.google.com/calendar/u/0/embed?src=c_6cm5hud8evuns4pe5ggu3h9qrs@group.calendar.google.com',
},
{
label: 'Community Meeting Notes',
to: '/community',
},
{
label: 'Maintainers',
to: '/people',
},
],
},
{
title: 'Social',
items: [
{
label: 'Twitter',
href: 'https://twitter.com/wasmcloud',
},
{
label: 'LinkedIn',
href: 'https://www.linkedin.com/company/wasmCloud/',
},
{
label: 'YouTube',
href: 'https://www.youtube.com/wasmcloud',
},
],
},
{
title: 'Organization',
items: [
{
href: 'https://ostif.org/ostif-has-completed-a-security-audit-of-wasmcloud/',
label: 'Security Assessment',
},
{
label: 'Privacy Policy',
to: '/privacy-policy',
},
{
label: 'Terms and Conditions',
to: '/terms-conditions',
},
{
label: 'Contact & Mailing List',
to: '/contact',
},
{
label: 'wasmCloud Swag',
to: '/swag',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} wasmCloud LLC. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page: https://www.linuxfoundation.org/trademark-usage. Built with Docusaurus.`,
},
...(offlineBuild
? {}
: {
algolia: {
apiKey: 'f0ef30f3d98ce5e9a7dd7579bb221dfc',
indexName: 'wasmcloud',
appId: '2IM4TMH501',
},
}),
} satisfies PresetClassicThemeConfig,
markdown: {
format: 'detect',
mdx1Compat: {
admonitions: false,
comments: false,
headingIds: false,
},
},
headTags: [
{
tagName: 'script',
attributes: { type: 'application/ld+json' },
innerHTML: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'Organization',
'@id': 'https://wasmcloud.com/#organization',
name: 'wasmCloud',
url: 'https://wasmcloud.com',
logo: {
'@type': 'ImageObject',
url: 'https://wasmcloud.com/logo/wasmcloud_green.svg',
},
description:
'wasmCloud is an open source CNCF project that enables teams to build, manage, and scale polyglot Wasm applications across any cloud, Kubernetes, or edge.',
foundingDate: '2020',
sameAs: [
'https://github.com/wasmCloud',
'https://twitter.com/wasmcloud',
'https://www.linkedin.com/company/wasmCloud/',
'https://www.youtube.com/wasmcloud',
'https://www.cncf.io/projects/wasmcloud/',
],
}),
},
{
tagName: 'script',
attributes: { type: 'application/ld+json' },
innerHTML: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'WebSite',
'@id': 'https://wasmcloud.com/#website',
name: 'wasmCloud',
url: 'https://wasmcloud.com',
publisher: { '@id': 'https://wasmcloud.com/#organization' },
inLanguage: 'en-US',
// M1 — enables Google sitelinks searchbox in brand-search results.
// Targets the Algolia DocSearch route which docusaurus serves at /search.
// The URL is derived from siteBaseUrl() so deploy previews on
// Netlify and local dev resolve to their own search endpoint rather
// than silently posting against production.
potentialAction: {
'@type': 'SearchAction',
target: {
'@type': 'EntryPoint',
urlTemplate: `${siteBaseUrl()}/search?q={search_term_string}`,
},
'query-input': 'required name=search_term_string',
},
}),
},
// Google Fonts: skipped in the offline build so air-gapped browsers do
// not request fonts.googleapis.com / fonts.gstatic.com. Falls back to
// the OS sans-serif via the CSS stack already declared in
// src/styles/index.css.
...(offlineBuild
? []
: [
{
tagName: 'link',
attributes: { rel: 'preconnect', href: 'https://fonts.googleapis.com' },
},
{
tagName: 'link',
attributes: {
rel: 'preconnect',
href: 'https://fonts.gstatic.com',
crossorigin: 'crossorigin',
},
},
{
tagName: 'link',
attributes: {
href: 'https://fonts.googleapis.com/css2?family=Caveat:wght@400..700&family=Lexend:wght@100..900&family=Inter:wght@100..900&display=swap',
rel: 'stylesheet',
},
},
]),
],
onBrokenAnchors: 'throw',
onDuplicateRoutes: 'throw',
};
})();
/** @return {import('@docusaurus/types').Plugin} */
function customPostCssPlugin() {
return {
name: 'custom-postcss',
configurePostCss(options) {
options.plugins.push(require('postcss-preset-env'));
return options;
},
};
}
type NavbarItem = Required<Required<PresetClassicThemeConfig>['navbar']>['items'][number];
type SvgNavItemOptions = NavbarItem & {
svgIconPath: string;
label: string;
href: string;
className?: string;
position?: 'left' | 'right';
};
/**
* build an icon nav item, works with styles in `src/styles/theme/_navbar.css`
*/
async function svgIconNavItem({
svgIconPath,
label,
href,
className,
position = 'right',
...extras
}: SvgNavItemOptions): Promise<NavbarItem> {
const icon = await fs.readFile(svgIconPath, 'utf-8');
const linkClass = 'navbar__icon';
return {
href: href,
position,
html: `
${icon}
<span class="navbar__icon-label">${label}</span>
`,
className: `${className ? `${className} ` : ''}${linkClass}`,
...extras,
};
}
module.exports = config;