Skip to content
Now accepting Q2 projects — limited slots available. Get started →
Architecture · Updated Apr 30, 2026

What is Static Site Generation (SSG)?

Static Site Generation (SSG) is a build-time rendering strategy that pre-generates HTML pages before deployment.

What is Static Site Generation (SSG)?

Static Site Generation (SSG) is where you build HTML pages once, at build time, then serve them from a CDN until you build again. Your build process runs templates against data sources — CMS, markdown files, APIs — and spits out plain HTML, CSS, and JavaScript. No server renders anything at request time. Just static files on a CDN.

This is why SSG sites hit TTFB under 100ms globally. We've measured 47ms average on Vercel's Edge Network. Google's "good" threshold is 800ms. You're beating that by 8x.

The technique isn't new. Jekyll shipped in 2008. But Gatsby, Hugo, and later Next.js and Astro turned it into the default for content sites. We've shipped SSG on 50+ projects at Social Animal. It's our starting point for any site where content updates are measured in hours, not seconds — marketing pages, docs, blogs.

How it works

Three phases: fetch data, render templates, deploy to CDN.

1. Data fetching at build time

Your framework pulls content from whatever you've wired up. Headless CMS like Sanity or Contentful, local markdown, a database, external APIs. In Next.js (App Router, v14+), you export generateStaticParams:

// app/blog/[slug]/page.tsx
export async function generateStaticParams() {
  const posts = await fetchAllPosts();
  return posts.map((post) => ({ slug: post.slug }));
}

export default async function BlogPost({ params }: { params: { slug: string } }) {
  const post = await fetchPost(params.slug);
  return <Article content={post} />;
}

In Astro, every .astro page is static by default. You have to opt into server rendering.

2. Template rendering

The framework executes each page's component tree, resolves all data dependencies, writes fully-formed HTML to a build output directory (.next/ or dist/). No server-side logic remains.

3. Deployment to CDN

You push the output directory to Vercel Edge Network, Cloudflare Pages, Netlify. Every request hits a cached file. No cold starts. No compute costs per request. No database connections.

The trade-off is build time. A 10,000-page site can take several minutes. That's where Incremental Static Regeneration (ISR) and on-demand revalidation come in — you update individual pages without rebuilding everything.

When to use it

SSG works for more use cases than people assume. Here's our decision framework:

Use SSG when:

  • Content changes infrequently (blogs, docs, landing pages, marketing sites)
  • You need maximum performance and lowest possible TTFB
  • SEO is critical and you want guaranteed crawlable HTML
  • You want near-zero hosting costs (CDN-only serving)
  • Security matters — there's no server to attack at runtime

Don't use SSG when:

  • Content is user-specific or requires authentication for the initial render
  • You have millions of pages and build times become unacceptable (though ISR helps)
  • Data changes every few seconds (stock tickers, live scores)
  • You need request-time logic like A/B testing at the HTML level (edge runtime is better)

Our stack at Social Animal: Astro for pure content sites. Next.js App Router when we need a mix of static and dynamic pages in the same project.

Static Site Generation vs alternatives

Strategy Rendering time TTFB Freshness Compute cost
SSG Build time ~50-100ms (CDN) Stale until rebuild Near zero
ISR Build time + background revalidation ~50-100ms (CDN) Configurable (e.g., 60s) Low
SSR Every request ~200-800ms+ Always fresh High
CSR (SPA) Client-side Fast shell, slow content Always fresh Zero server, high client
Edge SSR Every request at edge ~50-150ms Always fresh Medium

SSG and ISR are closely related. ISR is SSG with a cache revalidation layer. The jump from SSG to SSR is where you pay the real performance and cost penalty. For most content websites, SSG or ISR covers 90%+ of pages.

Real-world example

We built a SaaS documentation site with 1,200 pages using Astro 4 and Starlight. Full build: 38 seconds on Vercel's infrastructure. Every page scores 99-100 on Lighthouse Performance. TTFB averages 47ms globally.

The content team edits markdown in GitHub. A push to main triggers a rebuild. The whole thing deploys in under 2 minutes. Monthly hosting cost: $0 on Vercel's free tier.

Compare that to server-rendered equivalent. You'd need persistent compute, cold start mitigation, database connections. For content that updates a few times per week, SSG is the obvious answer.

Frequently asked questions about Static Site Generation (SSG)

Is Static Site Generation the same as Jamstack?
Not exactly. Jamstack is an architectural philosophy — JavaScript, APIs, and Markup — and SSG is one rendering strategy commonly used within it. A Jamstack site might use SSG for most pages but also include ISR, client-side API calls, or even edge functions. Think of SSG as a specific technique and Jamstack as the broader pattern that popularized it. Netlify coined the Jamstack term around 2015, and SSG predates it by years (Jekyll shipped in 2008). You can build a Jamstack site without SSG (using edge rendering, for instance), and you can use SSG outside of a Jamstack architecture.
When did Static Site Generation become a mainstream approach?
SSG has existed since the early web — static HTML files are the original delivery format. But the modern SSG movement started with Jekyll in 2008, which GitHub Pages adopted and made accessible. The real acceleration came in 2015-2018 with Gatsby (2015), Hugo's performance improvements, and Next.js adding `getStaticProps` in version 9.3 (March 2020). By 2021, SSG was a default strategy in most meta-frameworks. Astro, launched in 2021 and reaching 1.0 in August 2022, pushed SSG further by shipping zero JavaScript by default. As of April 2026, SSG is the standard starting point for content-driven sites.
What's the alternative to Static Site Generation?
The main alternatives are Server-Side Rendering (SSR), client-side rendering (CSR), and Incremental Static Regeneration (ISR). SSR generates HTML on every request, which gives you always-fresh content but costs more in latency and compute. CSR renders everything in the browser via JavaScript, which hurts SEO and initial load times. ISR is the closest alternative — it starts with SSG but revalidates pages in the background after a configurable interval, giving you near-SSG performance with better content freshness. For most teams, the real decision is between pure SSG and ISR, not between SSG and SSR.
How do you handle dynamic content on a statically generated site?
You combine static shells with client-side fetching or edge middleware. The static HTML loads instantly with all your SEO-critical content, then JavaScript hydrates and fetches personalized or real-time data — shopping carts, user dashboards, live notifications. This is sometimes called the "static shell" pattern. In Next.js, you'd generate the page statically and use React Server Components or client components for dynamic sections. In Astro, you'd use client-side islands (`client:load` or `client:visible` directives). The static part gives you the performance and SEO win; the dynamic part handles the rest. This pattern covers the vast majority of real-world use cases.
Get in touch

Let's build
something together.

Whether it's a migration, a new build, or an SEO challenge — the Social Animal team would love to hear from you.

Get in touch →