Static Site Generation Cheat Sheet
Covers pre-building HTML at build time with SSG, Next.js static generation APIs, deployment pipelines, and incremental regeneration.
2 PagesIntermediateMar 5, 2026
Static Generation (Next.js)
Declaring which pages to build, plus ISR revalidation.
javascript
// pages/blog/[slug].jsexport async function getStaticPaths() { const posts = await getAllPostSlugs(); // e.g. read markdown files return { paths: posts.map((slug) => ({ params: { slug } })), fallback: false, // any path not returned here => 404 };}export async function getStaticProps({ params }) { const post = await getPostBySlug(params.slug); // runs at build time return { props: { post }, revalidate: 3600, // ISR: regenerate at most once per hour };}export default function BlogPost({ post }) { return <article dangerouslySetInnerHTML={{ __html: post.html }} />;}
Build & Deploy Pipeline
Turning source content into static files, then shipping them.
bash
# Typical SSG build pipelinenpm run build # e.g. `next build`, `astro build`, `hugo`# Output: a directory of static HTML/CSS/JS/assets, e.g. ./out or ./dist# Deploy static output to a CDN/hostnpx vercel deploy ./out --prod# oraws s3 sync ./dist s3://my-bucket --deleteaws cloudfront create-invalidation --distribution-id ABC123 --paths "/*"
Key Concepts
Terminology that comes up across every SSG tool.
- Build time vs runtime- All HTML is generated once during the build, not per visitor request
- Content source- Markdown files, a headless CMS, or a database queried only at build time
- getStaticPaths/getStaticProps- Next.js APIs that declare which pages to build and their data
- Rebuild triggers- A CMS webhook or git push triggers a new build/deploy (e.g. build hooks)
- CDN caching- Static files are cacheable at the edge, giving fast global TTFB
- Popular tools- Next.js, Astro, Hugo, Eleventy (11ty), Jekyll, Gatsby
Pro Tip
For sites with thousands of pages, avoid full rebuilds on every content change — use Incremental Static Regeneration or on-demand revalidation so only the changed pages rebuild instead of the entire site.
Was this cheat sheet helpful?
Explore Topics
#StaticSiteGeneration#StaticSiteGenerationCheatSheet#WebDevelopment#Intermediate#StaticGenerationNextJs#BuildDeployPipeline#KeyConcepts#Covers#APIs#DevOps#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech
Professional Web Designing Services
- Responsive Websites
- E-commerce Solutions
- SEO Friendly Design
- Fast & Secure
- Support & Maintenance