How SSG Works

📦

Build Time Generation

During npm run build or npm run generate, Nuxt pre-renders all pages as static HTML files

🌐

CDN Distribution

Static files can be deployed to any CDN or static hosting service like Netlify, Vercel, GitHub Pages

Lightning Fast Loading

Users get pre-generated HTML directly, no server rendering needed, extremely fast loading

SSG Overview

A visual guide to how Nuxt SSG organizes your project — from file structure to final build output.

📁

Page Structure

Nuxt uses a file-based routing convention. Place .vue files in the pages/ directory, and routes are automatically generated — no manual configuration needed.

SSG Indicator

When SSG is enabled, pages are pre-rendered as static HTML at build time. The indicator confirms Static Site Generation is active for the route.

🔗

Routing Example

File paths map directly to URLs: pages/index.vue → /, pages/about.vue → /about, and dynamic routes like pages/blog/[slug].vue.

🖥️

Build Output

Running nuxi generate produces pre-rendered HTML files for every route, ready to deploy to any static hosting or CDN.

Performance Metrics

Loading Time Comparison

SSG
50ms
ISR
120ms
SSR
300ms

SSG Advantages

Lightning Fast

First load time typically < 100ms

🔍
SEO Friendly

Complete HTML content, easily indexed by search engines

💰
Cost Effective

No server needed, can deploy to free CDN

🛡️
Secure & Stable

Static files, no server security risks

Use Cases

📚

Documentation Sites

Technical docs, API documentation, user manuals with relatively fixed content

VuePressGitBookDocusaurus
🏢

Corporate Websites

Company introduction, product showcase, contact information and marketing sites

Landing PagePortfolioBrochure
✍️

Personal Blogs

Low-frequency publishing, infrequent content updates for personal websites

JekyllHexoGatsby

Configuration Example

// nuxt.config.ts
export default defineNuxtConfig({
  // Global SSG configuration
  nitro: {
    prerender: {
      routes: ['/ssg', '/about', '/contact']
    }
  },
  
  // Route-level configuration
  routeRules: {
    '/ssg': { prerender: true },
    '/blog/**': { prerender: true }
  }
})

📊 Page Information

Rendering Mode:SSG
Build Time:05/18/2026, 05:48:43 PM
Page Size:~15KB (gzipped)
First Load:< 100ms