100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Web

Static Site Generation (SSG)

IntermediateTechnique8.7K learners

Static Site Generation (SSG) is a technique where a site's HTML pages are pre-rendered once at build time and served as plain static files, rather than being generated per request on the server or entirely in the browser.

Definition

Static Site Generation (SSG) is a technique where a site's HTML pages are pre-rendered once at build time and served as plain static files, rather than being generated per request on the server or entirely in the browser.

Overview

SSG sits between traditional server rendering and client-side rendering: instead of generating HTML on every request like Server-Side Rendering (SSR), a build process runs ahead of time — pulling data from a CMS, database, or markdown files — and outputs a complete set of static HTML files that can be served directly from a CDN with no server-side compute per visit. Because the pages are pre-built, SSG sites tend to be extremely fast and cheap to host, and they are inherently resilient to traffic spikes since there's no per-request rendering cost. Tools like Astro, Gatsby, Hugo, and Next.js (in its static export mode) all support SSG, often pulling content from a Headless CMS so non-technical editors can update content that gets baked into the next build. The main trade-off is freshness: content changes require a new build and redeploy (or a mechanism like Incremental Static Regeneration (ISR) to update pages without a full rebuild), which makes SSG better suited to content that changes infrequently — blogs, documentation, marketing pages — than to highly dynamic, personalized, or frequently updated data.

Key Concepts

  • HTML pre-rendered at build time, served as static files
  • Extremely fast page loads with no per-request server compute
  • Easily and cheaply hosted on a CDN
  • Naturally resilient to traffic spikes
  • Content typically sourced from a CMS, markdown, or database at build time
  • Requires a rebuild (or ISR) to reflect content changes

Use Cases

Blogs, documentation sites, and marketing pages
Content that changes infrequently and doesn't need per-request personalization
Sites prioritizing maximum speed and minimal hosting cost
JAMstack architectures combining SSG with headless CMS content

Frequently Asked Questions

From the Blog