What is Static Generation (SSG)?
TL;DR
Pre-rendering strategy that generates HTML at build time for maximum performance and SEO benefits.
Static Generation (SSG) pre-renders pages at build time, generating HTML that can be cached and served instantly from CDN.
Static pages:
export default async function BlogPost({ params }) {
const post = await getPost(params.id);
return <Article post={post} />;
}
export async function generateStaticParams() {
const posts = await getAllPosts();
return posts.map(post => ({ id: post.id }));
}
Benefits:
- Maximum performance - instant page loads
- Perfect SEO - fully rendered HTML
- Reduced server costs - serve from CDN
- Enhanced security - no server runtime needed
AI-friendly: Static generation strategy is explicit through generateStaticParams, making build-time rendering obvious and predictable.