Edge Prerendering
Render a page during deployment and its first visitor can read the cached HTML immediately. Void already does this for two kinds of pages:
- Markdown pages are auto-prerendered.
- Island pages with no companion loader and no dynamic params are also auto-prerendered.
Static pages (no params)
To prerender your About page, export prerender from its companion .server.ts file.
// pages/about.server.ts
export const prerender = true;Dynamic pages (with params)
For a dynamic page, export getPrerenderPaths() to choose which paths to render. Annotate its return type with PageParams so TypeScript checks the parameter names:
// pages/blog/[slug].server.ts
import type { PageParams } from 'void/routes';
export const prerender = true;
export async function getPrerenderPaths(): Promise<PageParams<'/blog/[slug]'>[]> {
return [{ slug: 'hello-world' }, { slug: 'getting-started' }];
}Return an object for each path, with every required parameter. Values can be strings or numbers; Void URL-encodes them. Use a catch-all page such as pages/docs/[...slug] for values containing /, for example { slug: 'guides/intro' }.
Custom SSR
For custom SSR, export getPrerenderPaths() from src/main.ssr.ts and return full paths:
// src/main.ssr.ts
export const prerender = true;
export async function getPrerenderPaths(): Promise<string[]> {
return ['/', '/about', '/blog/hello-world'];
}Relationship to revalidation
Setting routing.isr: false in void.config.ts disables ISR and this edge-prerendering behavior, including per-page exports. It does not disable build-time HTML generation with output: "static".
Prerendered pages default to a one-year revalidate TTL. Deploys clear the ISR cache.
Override the TTL per page:
// pages/about.server.ts
export const prerender = true;
export const revalidate = 3600;If the cached page expires before your next deploy, the next request waits for a fresh render.
Behavior details
- Prerender happens once per deployment, before traffic is routed to the new version. Prerendered pages are cached at the edge.
- Only paths with a positive revalidate TTL are prerendered (TTL
0is skipped). - Prerender failures are logged but never block the deploy. The page will render on the first request as usual.