Overview
Static site generation renders each page to an HTML file during the build and serves the files from a CDN, so build time scales with page count and traffic adds no compute cost. Pick it for docs, blogs, and marketing pages that change on deploy. Per-user or real-time data needs ssr, isr, or client fetching.
Rules
- The limit is staleness: the site shows data as of the last build. Rebuild on every merge, or regenerate selectively with isr.
- Astro, Hugo, and Eleventy build static output by default. In Next.js, prerender dynamic routes with
generateStaticParams, or setoutput: "export"for pure static files (no ISR, cookies, rewrites, or Server Actions). - Static HTML from the CDN edge gives the best lcp. Add hydration only for interactive parts.