mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-13 17:35: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:
@@ -1,22 +1,24 @@
|
||||
import { ImageResponse } from 'next/og';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { source, getPageImage } from '@/lib/source';
|
||||
import { getAllDocPages, getPage, getPageImage } from '@/lib/source';
|
||||
import { generate as DefaultImage } from 'fumadocs-ui/og';
|
||||
|
||||
export const revalidate = false;
|
||||
export const dynamicParams = false;
|
||||
export const dynamic = 'force-static';
|
||||
|
||||
export async function GET(request: Request, context: any) {
|
||||
export async function GET(_request: Request, context: any) {
|
||||
const { slug } = await context.params;
|
||||
const page = source.getPage(slug.slice(0, -1));
|
||||
if (slug[slug.length - 1] !== 'image.png') notFound();
|
||||
|
||||
const { page } = getPage(slug.slice(0, -1));
|
||||
if (!page) notFound();
|
||||
|
||||
return new ImageResponse(
|
||||
<DefaultImage
|
||||
title={page.data.title}
|
||||
description={page.data.description}
|
||||
site="My App"
|
||||
site="ZITADEL Docs"
|
||||
/>,
|
||||
{
|
||||
width: 1200,
|
||||
@@ -26,7 +28,7 @@ export async function GET(request: Request, context: any) {
|
||||
}
|
||||
|
||||
export function generateStaticParams() {
|
||||
return source.getPages().map((page) => ({
|
||||
return getAllDocPages().map((page) => ({
|
||||
slug: getPageImage(page).segments,
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user