Static Site Generation

nuxi generate — Crawl & Prerender Every Route

Static Site Generation

nuxi generate crawls your app, prerenders each reachable route to HTML, and outputs to dist — ready for any static host.

4 min read Level 2/5 #nuxt#ssg#generate
What you'll learn
  • Run nuxi generate to produce a static build
  • Specify routes explicitly with nitro prerender config
  • Deploy the output to a static host

When your content does not change per request, you can pre-render every page at build time and deploy plain HTML — no server needed.

nuxi generate

npx nuxi generate

Nuxt starts at / and crawls every internal link it finds, prerendering each as an HTML file. The output lands in dist/ (or .output/public).

Explicit Routes

For pages that are not reachable from / (orphan URLs, dynamic IDs not yet linked), list them explicitly:

// nuxt.config.ts
export default defineNuxtConfig({
  nitro: {
    prerender: {
      routes: [
        '/sitemap.xml',
        '/blog/welcome',
        '/blog/release-notes'
      ],
      crawlLinks: true
    }
  }
})

Where to Deploy

Any static host works:

  • Cloudflare Pages
  • Netlify
  • Vercel (it auto-detects SSG)
  • GitHub Pages
  • S3 + CloudFront

Upload dist/ and you are done. No Node runtime, no scaling concerns.

Caveats

  • Every prerendered page is frozen at build time — you redeploy to update content.
  • useFetch runs at build time; pages get the data captured then. For freshness, swap to SWR or ISR (next lessons).
  • Routes generated dynamically (e.g. user profiles) require either listing them all or switching that path to SSR/SWR via routeRules.
Hybrid Rendering With routeRules →