Skip to content
IT glossary
FrontendUpdated December 3, 2026

Static site generation

SSG

With static site generation (SSG), a website builds its HTML pages ahead of time. When someone requests a page, the host sends the prebuilt HTML instead of generating it for that visit.

Also known as: статическая генерация

What static site generation means

Think of a documentation site with one Markdown file per article. Rather than opening a file and turning it into HTML every time a reader visits, a static site generator does that work during a build. The published output already contains the article's HTML, so a static host can serve it directly and a content delivery network (CDN) can cache it close to readers.

From source content to a page

The build first determines which URLs to produce. It might get that list from files in a repository or fetch it from a content management system (CMS). For each URL, it reads the relevant data, renders a template or component, and writes the resulting HTML. The deployment publishes that output along with assets such as stylesheets, images, and any browser scripts. Serving the initial HTML doesn't require running the page's rendering code for each request.

For example, a recipe site could read a CMS entry with the slug tomato-soup and produce dist/recipes/tomato-soup/index.html. A host configured to serve directory index files can return it for /recipes/tomato-soup/. If an editor changes the cooking time in the CMS, that file still contains the old value. A common setup uses a CMS publish webhook to trigger a rebuild and deployment. Depending on the cache configuration, the old HTML may also need to expire or be purged.

What “static” does and doesn't mean

SSG describes when the initial HTML is produced, not whether the page can respond to input. A generated recipe page can run a timer in JavaScript or fetch the reader's saved recipes from an API. Some frameworks use hydration to make prebuilt markup interactive.

The distinction from request-time server-side rendering (SSR) is timing: with SSR, the server can generate HTML from the data available when a request arrives. With client-side rendering (CSR), browser JavaScript generates the relevant page content. These strategies can coexist: a prebuilt page can deliver its main content in HTML and render a personalized panel in the browser.

When to use it

SSG works well for public content that many visitors share, such as documentation, blogs, and marketing pages. Prebuilding removes rendering work from the request path, but moves it into the build. Generating a few hundred pages may be straightforward; rebuilding a large catalog on every edit may slow down publishing. If only stock availability needs to be current, you can prebuild the product description and fetch availability separately. If the initial HTML must show current or request-specific data, request-time rendering may fit better.

How it comes up in interviews

A common question is whether a route like /products/[slug] rules out SSG. It doesn't: the generator can produce a page for each product slug it knows about at build time. A useful follow-up is to explain what happens when a new product is added or an existing price changes. State how the affected pages get regenerated, when caches serve the new version, and which fields, if any, should be loaded at request time instead.