What is Static Site Generation (SSG)?
Static Site Generation (SSG) is a rendering strategy where web pages are pre-built into HTML files at build time, before any user requests them. When a visitor loads the site, they receive a ready-made HTML file directly — no server-side processing, no database queries, no runtime rendering. The result is fast page loads, strong security, and straightforward hosting.
How SSG Works
During a build step (typically triggered by a deployment pipeline), the SSG framework fetches data from its sources — a headless CMS, markdown files, a database, or an API — and generates a complete set of HTML pages. These static files are then deployed to a CDN or static hosting service.
The process follows a straightforward pipeline: a build is triggered (by a code push or content change), the framework fetches content from all configured sources, renders every page into static HTML/CSS/JS files, and deploys them to a CDN. When a user requests a page, the CDN returns the pre-built file with minimal latency.
SSG vs. SSR vs. ISR
Modern frameworks offer several rendering strategies, each with different trade-offs:
Static Site Generation (SSG) generates all pages at build time. Pages are fast and cacheable, but content updates require a full rebuild. Best for content that changes infrequently — documentation, marketing sites, blogs.
Server-Side Rendering (SSR) generates each page on the server at request time. Every request hits the server, which fetches data and renders HTML on the fly. This ensures content is always current but adds server load and latency. Best for highly dynamic or personalized pages.
Incremental Static Regeneration (ISR) is a hybrid approach (popularized by Next.js) that serves statically generated pages but revalidates them in the background after a configurable time interval. When the revalidation period expires, the next request triggers a background regeneration. This provides near-static performance with fresher content, without requiring a full rebuild.
Many modern frameworks support mixing these strategies within a single site. A documentation page might use SSG, a dashboard might use SSR, and a blog listing might use ISR.
SSG with a Headless CMS
Static Site Generation pairs naturally with headless CMS platforms. The CMS manages content through its editorial interface, and the SSG framework pulls that content at build time through the CMS's API. This gives content teams a familiar editing experience while delivering the performance and security benefits of static files.
The typical workflow involves an editor publishing content in the CMS, which triggers a webhook that starts a new build. The build process fetches all content via the API, regenerates affected pages, and deploys the updated static files to the CDN. This works well for sites where content changes are measured in hours or days. For real-time updates, SSR or ISR may be more appropriate.
SSG with Decoupled.io
Decoupled.io works with popular SSG-capable frameworks. Content managed in Drupal is available through the API layer, which these frameworks call during their build process. See the integration guides for Next.js and Astro for setup instructions and best practices.