Suggest an editImprove this articleRefine the answer for “What is SSG and when is it used?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**SSG (Static Site Generation)** is an approach where pages **are generated ahead of time at build time** and served to the user as ready-made HTML files. **Key point:** SSG is used for fast, SEO-friendly content that rarely changes and is the same for all users.Shown above the full answer for quick recall.Answer (EN)Image**SSG (Static Site Generation)** is an approach where pages **are generated ahead of time at build time** and served to the user as ready-made HTML files. In short: > build -> ready HTML -> instant load --- ## How SSG works Using **Next.js** as an example: 1. During `next build` 2. Next.js runs the React code 3. Generates HTML for the pages 4. Stores them as static files 5. A CDN serves them to users --- ## How SSG differs from SSR | Criterion | SSG | SSR | |---|---|---| | When it renders | At build time | On every request | | Speed | Maximum | Fast, but slower | | Server load | None | Yes | | SEO | Excellent | Excellent | | Personalization | No | Yes | --- ## Why SSG is needed ### 1. Maximum speed - HTML is already ready - served from a CDN - minimal TTFB --- ### 2. Minimal infrastructure - no server needed - no computation per request - cheap hosting --- ### 3. Great for SEO - all content is available immediately - indexes reliably --- ## When to use SSG - landing pages - blogs - documentation - marketing pages - reference pages - "About us" pages Content **rarely changes** and **is the same for everyone**. --- ## When SSG does NOT fit - personalized data - data depends on cookies / auth - frequent content changes (without ISR) --- ## SSG in Next.js SSG is enabled automatically when: - the page does not use dynamic data - `fetch()` is used without `cache: 'no-store'` - there is no dependency on the request It is also often used together with **ISR** (updates without a rebuild). --- ## Short interview answer > **SSG is generating HTML pages at build time. It is used for fast, SEO-friendly content that rarely changes and is the same for all users.**For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.