Using Next.js Incremental Static Regeneration to Keep Jamstack Sites Fresh
Jamstack sites are fast but can become stale. Next.js Incremental Static Regeneration (ISR) rebuilds pages in the background after a set interval, keeping content fresh without a full rebuild. This guide shows a concrete example, trade‑offs, and a checklist.
15 Feb 2026, 19:49 UTC

Problem: Static Sites Can Be Stale
Jamstack sites ship pre‑rendered HTML from a CDN, giving lightning‑fast page loads. The trade‑off is that any content change requires a full rebuild and redeploy, which can be slow for large sites or frequent updates. Developers often ask: How can I keep a static site up‑to‑date without rebuilding everything?
Thesis: Incremental Static Regeneration (ISR) Bridges the Gap
ISR lets Next.js serve a statically generated page from the CDN until a background regeneration cycle runs. After a specified interval, the page is rebuilt with fresh data, but the old version continues to be served until the new one is ready, ensuring zero downtime and no visible flicker.
1. What ISR Actually Does
- Builds a page at deploy time using
getStaticProps. - Stores the rendered HTML in the CDN’s edge cache.
- When the
revalidateinterval expires, the CDN triggers a rebuild in the background. - Once the new page is ready, the CDN swaps the old cache entry for the fresh one.
2. Enabling ISR in a Next.js Project
Below is a minimal example for a blog post page that pulls data from an external CMS. The page is regenerated every minute.
// pages/blog/[slug].js
import { useRouter } from 'next/router';
export async function getStaticProps({ params }) {
const res = await fetch(`https://cms.example.com/posts/${params.slug}`);
const post = await res.json();
return {
props: { post },
// Revalidate after 60 seconds
revalidate: 60,
};
}
export async function getStaticPaths() {
const res = await fetch('https://cms.example.com/posts');
const posts = await res.json();
const paths = posts.map((p) => ({ params: { slug: p.slug } }));
return { paths, fallback: false };
}
export default function Post({ post }) {
const router = useRouter();
if (router.isFallback) return Loading…;
return (
{post.title}
);
}
Run the dev server with npm run dev (or yarn dev). ISR behavior is identical in production.
3. Verifying ISR Works
- Deploy to a CDN‑based host (e.g., Vercel, Netlify). Ensure the build logs show the page was generated.
- Open the page in a browser and check the network tab. The first request should be a
200from the CDN edge cache. - Wait for the revalidation window (60 s in the example) and then modify the CMS entry.
- Refresh the page and look for a new
200response. The content should now reflect the updated CMS data. - Check the build logs for a “Revalidated” message indicating the background rebuild completed.
Risk: If traffic is low, the CDN may not trigger regeneration immediately after the interval. In that case, the page can stay slightly stale until the next request.
4. Trade‑offs & Limitations
- Only pages using
getStaticPropscan be regenerated. Dynamic routes withgetServerSidePropswill always hit the server. - Revalidation interval is a hint. The CDN may delay the rebuild if no requests arrive, leading to stale content for low‑traffic pages.
- Edge caching means you cannot rely on server‑side session data or request‑specific logic in the regenerated page.
- Cache invalidation can be manual if you need to force an immediate update (e.g., by bumping the
revalidatevalue or using a preview mode).
5. Actionable Checklist for Your Jamstack Site
- Wrap static pages with
getStaticPropsand set a sensiblerevalidatevalue (e.g., 60–300 s). - Ensure your data source supports efficient fetching (e.g., GraphQL queries with pagination).
- Deploy to a CDN that supports ISR (Vercel, Netlify, Cloudflare Pages).
- After deployment, monitor the network tab for
200responses and the build logs for “Revalidated” entries. - Set up alerts for failed regeneration (most hosts provide webhook or log‑based alerts).
- For critical pages, consider a preview mode that bypasses the cache for immediate updates.
Conclusion
ISR gives Jamstack developers a pragmatic way to keep content fresh without sacrificing performance or rebuild costs. By configuring a revalidate interval, you let the CDN handle regeneration in the background, delivering a near‑real‑time experience to users. Just remember the constraints: it only works with getStaticProps, the interval is a hint, and low traffic can delay updates. With a quick verification routine and a clear action plan, ISR can become a core part of your Jamstack deployment strategy.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.