Static Site Generation
With Next.js 16, everything is Dynamic by Default. We now use 'use cache' to explicitly pre-render this page at build time. This ensures you receive a pre-built HTML file from the CDN nearly instantly.
Time is frozen at Build Time. No matter how many times you refresh, this HTML is static.
Strategy
Static Opt-In: Using 'use cache', we manually restore the SSG behavior in the modern dynamic-first pipeline.
Hydration
Server sends finished HTML. Browser 'hydrates' it for interactivity.
Cold start. No cache exists yet.
Architectural Insights
Hover over headers to reveal
Infrastructure Lifecycle Data.
Use the timeline buttons at the top to simulate how headers evolve over time in a production environment.
Live Demo
These products were fetched using Static Site Generation (SSG) at Build Time.
Refreshing won't change the time. This HTML is a physical file on the server.
Essence Mascara Lash Princess
The Essence Mascara Lash Princess is a popular mascara known for its volumizing and lengthening effects. Achieve dramatic lashes with this long-lasting and cruelty-free formula.
Eyeshadow Palette with Mirror
The Eyeshadow Palette with Mirror offers a versatile range of eyeshadow shades for creating stunning eye looks. With a built-in mirror, it's convenient for on-the-go makeup application.
Powder Canister
The Powder Canister is a finely milled setting powder designed to set makeup and control shine. With a lightweight and translucent formula, it provides a smooth and matte finish.
Red Lipstick
The Red Lipstick is a classic and bold choice for adding a pop of color to your lips. With a creamy and pigmented formula, it provides a vibrant and long-lasting finish.
Red Nail Polish
The Red Nail Polish offers a rich and glossy red hue for vibrant and polished nails. With a quick-drying formula, it provides a salon-quality finish at home.
Calvin Klein CK One
CK One by Calvin Klein is a classic unisex fragrance, known for its fresh and clean scent. It's a versatile fragrance suitable for everyday wear.
Chanel Coco Noir Eau De
Coco Noir by Chanel is an elegant and mysterious fragrance, featuring notes of grapefruit, rose, and sandalwood. Perfect for evening occasions.
Dior J'adore
J'adore by Dior is a luxurious and floral fragrance, known for its blend of ylang-ylang, rose, and jasmine. It embodies femininity and sophistication.
1Normal Pages
Standard pages like /about or /contact are automatically generated as static HTML files during the build process if they don't use dynamic functions like cookies() or headers().
2Dynamic ID Pages
For dynamic routes like /blog/[id], use generateStaticParams. This tells Next.js which specific IDs to pre-render at build time, ensuring those pages load instantly like static ones.
The generateStaticParams Pattern (Dynamic SSG)
// src/app/blog/[id]/page.tsx
export async function generateStaticParams() {
const posts = await fetch('https://api.com/posts').then(res => res.json());
// Next.js will build ALL these pages at Build Time
return posts.map((post) => ({
id: post.id.toString(),
}));
}The SSG Evolution
Next.js 16 moves from guessing if a page is static to an Explicit Opt-in model.
Implicitly Static
Next.js assumes static behavior by default. However, non-deterministic functions like new Date() will force the entire page to dynamic on every request.
Explicitly Static
Using 'use cache' forces the compiler to snapshot the component. This freezes the result of dynamic functions into the static build.
When to deploy 'use cache'?
Build Snapshots: When you need a "Last Updated" timestamp on every page without triggering SSR.
Query Isolation: When a component performs a heavy DB query that only needs to run during build.
Static Islands: When using PPR to make specific parts of a dynamic route perfectly static.