Skip to content
Built with

Static site generation (SSG) ​

Build & Deploy

Prerender every page to static HTML at build time, then deploy the result anywhere.

On this pageTurn on static output · Override it per page · Compare SSG with edge prerendering

This step prerenders every page at build time. Set output: "static" in void.config.ts.

json
{
  "output": "static"
}

With output: "static":

  • Pages default to prerender = true and are written as HTML files to dist/client/.
  • To opt a page out, add export const prerender = false to its .server.ts. That page renders on request.
  • Dynamic pages without getPrerenderPaths() are not prerendered. Their paths are unknown at build time.
  • The output is self-contained. It works with direct Cloudflare deploys, self-hosting or void deploy.

Per-page overrides ​

This step opts one page out of prerendering.

ts
// pages/dashboard.server.ts
export const prerender = false;

This step prerenders a dynamic page. getPrerenderPaths() returns the params to render.

ts
// pages/blog/[slug].server.ts
export async function getPrerenderPaths() {
  return [{ slug: 'hello-world' }, { slug: 'getting-started' }];
}

Comparison with edge prerendering ​

output valueDefault prerenderPer-page overridePrerender timing
"server" (default)falseexport const prerender = trueDeploy-time (platform ISR)
"static"trueexport const prerender = falseBuild or deploy post-build

With the default output: "server", use export const prerender = true for deploy-time edge prerendering.

Deployment behavior ​

void deploy picks the deployment type for you:

  • Fully static: every page is prerendered, with no API routes, middleware, cron jobs or queues. The SDK deploys a static site with no worker.
  • Hybrid: some pages cannot be prerendered, such as dynamic pages without getPrerenderPaths() or pages with prerender = false. A worker serves those routes at runtime. Prerendered pages are still static assets.

Relationship to inference.appType: "static" ​

inference.appType describes the app type: SPA, static or void. output sets the rendering strategy.

inference.appType: "static"output: "static"
WhatDeploy a pre-built static site (no SDK plugin)Prerender an SDK app at build time
WorkerNone (static assets only)Only if some pages can't be prerendered
Use caseVitePress, plain HTML, external SSG toolsSDK apps with mostly or fully static content

Next steps ​

implemented.stream AI