Static rendering
- When HTML is built
- At build time
- Best for
- Content sites with predictable URLs
- Drawback
- Must generate an HTML file for every possible URL; poor fit for personalization
Static site generation pre-renders HTML for every page at build time. Pages are fast, cache-friendly, and ideal for content sites and blogs.
Static site generation (SSG) builds finished HTML files for your pages ahead of time, at build time, instead of generating them for each request. Per web.dev, static rendering produces a separate HTML file for each URL, giving a consistently fast TTFB and CDN-friendly pages. It fits sites whose URLs you can list in advance.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
The build must know which URLs exist. web.dev names this as the main drawback: static rendering must generate individual HTML files for every possible URL, which is hard when you can't anticipate them or have a very large number of unique pages.
// pages/posts/[slug].js
export async function getStaticPaths() {
const posts = await fetchAllPosts();
return {
paths: posts.map((p) => ({ params: { slug: p.slug } })),
fallback: 'blocking', // build unknown slugs on first request
};
}
export async function getStaticProps({ params }) {
const post = await fetchPost(params.slug);
// Refresh in the background at most once every 3600 seconds
return { props: { post }, revalidate: 3600 };
}The trade-off is the URL list. web.dev says generating a file for every possible URL can be challenging or even infeasible for sites with a large number of unique pages, and that pages needing personalization don't work well with static rendering.
Choose it when you can list your URLs at build time, such as blogs, documentation, and marketing sites. web.dev's advice is to consider whether static or server rendering can get you most of the way there. Skip it, or combine it with server rendering, if you have very large numbers of unique URLs or need per-user content.
3 questions people ask next, answered from the sources on this page.
No. web.dev encourages developers to consider server-side rendering or static rendering over a full rehydration approach, and says it's fine to mostly ship HTML with minimal JavaScript.
Yes. Add client-side JavaScript for forms, filters, or carts, or fetch data from APIs. The page arrives as prebuilt HTML, and scripts add behavior on top.
Change the content source and rebuild, or use a feature like ISR to refresh pages in the background. Check your host's docs for how to trigger a rebuild when your content changes.
The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.