Contact

What is SSG (Static Site Generation)?

Definition

SSG (static site generation) means producing a website's HTML files once, at build time, before any visitor requests them. The resulting HTML, CSS and JavaScript files are served as-is from any web server or CDN, with no database queries or rendering at request time. Tools that perform this step are called static site generators.

Also known as: static site generation, static site generator, static rendering, prerendering

Static site generation: content and data are turned into HTML pages once at build time and served quickly to visitors from a CDN

What happens at build time

With static generation, rendering happens before anyone visits. Content might live in Markdown files, a headless CMS or an API. The generator combines that data with templates and writes one HTML file per URL. The output folder is deployed as it is:

out/
├── index.html
├── about/index.html
├── blog/
│   ├── index.html
│   ├── first-post/index.html
│   └── second-post/index.html
├── _assets/app-3c9e1f.js
└── _assets/style-81b0d2.css

This is one stage of the build process, usually run automatically in a CI/CD pipeline. When an editor publishes a post in the CMS, a webhook kicks off a new build, and a few minutes later the updated files are live.

Static site generators

Some tools exist purely to produce static output; others offer static generation as one option inside a broader framework.

ToolWritten inNotes
HugoGoKnown for building very large sites quickly
JekyllRubyA long-established, blog-oriented generator
EleventyJavaScriptMinimal and template-language agnostic
AstroJavaScriptOutputs HTML with no client JavaScript by default
Next.jsJavaScriptPrerenders pages by default where it can; output: 'export' produces a fully static build

Speed, security and cost

Serving a finished file is always faster than querying a database and running templates on every request. Served from a CDN close to the user, static pages typically achieve a very low TTFB. With no application server or database connection in the request path, the attack surface shrinks, and absorbing a traffic spike is mostly the CDN's problem. Hosting costs fall accordingly.

The limits: build times and stale content

  • Every change means a rebuild. Fixing one typo regenerates the whole site, which on a catalogue of tens of thousands of pages can take minutes or longer.
  • No personalisation at build time. A cart, a logged-in name or location-based pricing has to be added with client-side JavaScript or a separate server-side layer.
  • Dynamic features move to services. Form handling, on-site search and comments need an API or a third-party provider.

The best-known middle ground for these limits is ISR, which regenerates individual pages in the background instead of rebuilding everything.

Static doesn't mean non-interactive

A common misconception is that a statically generated site can't use JavaScript. "Static" only describes when the HTML is produced. A page built ahead of time can be hydrated in the browser and become fully interactive. For search engines the result matches server-side rendering: content, headings and links are already in the first HTML response.

Related terms

← Back to the glossary