mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-14 01:45:12 +00:00
perf: optimize docs static generation cost (#12108)
## Summary - Switch the docs catch-all route to full static generation and prebuild both latest and versioned docs paths. - Prebuild OG images for all docs pages, make sitemap and LLM export static, and remove nondeterministic sitemap timestamps. - Reduce build-time overhead by memoizing docs sidebar trees and skipping processed markdown generation for versioned docs. ## Testing - `pnpm nx run @zitadel/docs:build` - `pnpm nx run @zitadel/docs:lint` - `pnpm nx run @zitadel/docs:check-types` - Verified the prerender manifest contains 8,816 prerendered routes, 3,293 versioned docs routes, 4,406 OG routes, and zero revalidating docs routes.
This commit is contained in:
+19
-20
@@ -1,27 +1,26 @@
|
||||
import { MetadataRoute } from 'next';
|
||||
import { source } from '@/lib/source';
|
||||
|
||||
export const revalidate = false;
|
||||
export const dynamic = 'force-static';
|
||||
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
const baseUrl = 'https://zitadel.com/docs';
|
||||
const baseUrl = 'https://zitadel.com/docs';
|
||||
|
||||
const docsPages = source.getPages().map((page) => ({
|
||||
url: `${baseUrl}${page.url === '/' ? '' : page.url}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly' as const,
|
||||
priority: 0.8,
|
||||
}));
|
||||
const docsPages = source.getPages().map((page) => ({
|
||||
url: `${baseUrl}${page.url === '/' ? '' : page.url}`,
|
||||
changeFrequency: 'weekly' as const,
|
||||
priority: 0.8,
|
||||
}));
|
||||
|
||||
|
||||
|
||||
return [
|
||||
{
|
||||
url: baseUrl,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'daily' as const,
|
||||
priority: 1,
|
||||
},
|
||||
...docsPages,
|
||||
].filter((item, index, self) =>
|
||||
index === self.findIndex((t) => t.url === item.url)
|
||||
);
|
||||
return [
|
||||
{
|
||||
url: baseUrl,
|
||||
changeFrequency: 'daily' as const,
|
||||
priority: 1,
|
||||
},
|
||||
...docsPages,
|
||||
].filter(
|
||||
(item, index, self) => index === self.findIndex((t) => t.url === item.url),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user