Static Site Generation (SSG)
Static site generation (SSG) builds a website's pages into finished HTML files ahead of time, so servers deliver ready pages instantly instead of building them per visit.
Also called: SSG, static site, static site generator, pre-rendering, server-side rendering
Static site generation, or SSG, builds a website's pages into finished HTML files before anyone visits. When someone requests a page, the server just hands over the ready file. There is no database query or page assembly at that moment. The result is fast, cheap to host and easy for search engines to read.
How it works
A static site generator takes content and templates and produces HTML at build time. Content might come from Markdown files, a headless CMS, a spreadsheet or an API. The output gets deployed to a CDN, which stores copies close to visitors around the world.
There are a few rendering approaches, and most modern frameworks mix them:
- Static site generation (SSG): pages built once at build time. Best for content that changes on a schedule, like marketing pages, docs, glossaries and blogs.
- Incremental regeneration: pages built on first request or on a timer, then cached. Lets very large sites skip full rebuilds.
- Server-side rendering (SSR): each page built on the server per request. Best for content that changes per user or minute by minute.
- Client-side rendering (CSR): the browser builds the page with JavaScript. Fine for logged-in apps, risky for SEO pages, since crawlers may not see content right away.
For SEO, SSG and SSR both send complete HTML. That helps indexing and avoids the risk of content that only appears after scripts run. SSG adds speed, since nothing is computed per visit. Each content change does need a rebuild and deploy, which teams usually automate.
Example
A company moves its marketing site from a traditional database-driven CMS to a static setup with a headless CMS (all numbers hypothetical).
| Measure | Before (built per request) | After (static on CDN) |
|---|---|---|
| Time to first byte, mobile | 900ms | 80ms |
| LCP at 75th percentile | 3.9s | 1.9s |
| Hosting cost a month | $600 | $40 |
| Time from publish to live | Instant | About 2 minutes per rebuild |
Speed and cost improve a lot. The trade-off is the rebuild delay. Marketers who were used to instant publishing now wait two minutes. The team adds a preview step so editors can check changes first, which they now see as a feature.
By company size
Small business: Most small businesses use hosted website builders and never need to think about SSG. It matters if a developer builds your site. Ask whether pages are pre-rendered, since that usually means a faster, cheaper site.
Mid-market: SSG with a headless CMS is a common setup for growing companies. Marketing edits content in the CMS. A build pipeline publishes it. Developers keep control of design and performance. It also suits programmatic SEO, where thousands of pages come from one template and a dataset.
Enterprise: Large sites mix approaches by page type. Marketing and docs pages are static. Pricing calculators and personalized pages use SSR. Product catalogs often use incremental regeneration to avoid hours-long builds.
Static site generation vs a traditional CMS
A traditional content management system stores content in a database and builds pages on each request. Editing feels instant and plugins are easy. Static setups trade some of that convenience for speed, security and lower hosting costs. The right choice depends on who edits content, how often and how much developer time you have.
Why it matters for GTM teams
Rendering choices decide how fast your pages load and how reliably search engines read them. We default to static generation for marketing pages, glossaries and content hubs, because it's fast and hard to break. We'd pair it with automated builds, preview deployments for editors and incremental builds once page counts grow. We'd avoid client-side rendering for anything we want to rank.
Common mistakes
- Rendering SEO pages only in the browser with JavaScript.
- Forgetting to trigger rebuilds, so published edits never go live.
- Running full rebuilds on huge sites instead of incremental builds.
- Generating thousands of thin pages just because a template makes it easy.
- Giving editors no preview step, so mistakes ship straight to production.
- Hard-coding content in templates so marketing can't edit without a developer.
FAQ
Is static site generation good for SEO?
Yes. Search engines receive complete HTML right away, with no need to run JavaScript to see the content. Pages also tend to load fast because they are served from a CDN. The main risk is stale content if rebuilds are slow or forgotten.
What is the difference between SSG and SSR?
SSG builds pages once, at build time, and serves the same file to everyone. SSR, or server-side rendering, builds each page on the server when a visitor requests it. SSG is faster and cheaper to serve, while SSR suits pages that change per user or every minute.
Can a static site have thousands of pages?
Yes, but full rebuilds get slow as page counts grow. Frameworks offer incremental approaches that build pages on first request and cache them, or rebuild only changed pages. That makes SSG workable for large programmatic sites.