Implementing Incremental Static Regeneration (ISR) in Jamstack Sites
Learn how to use Incremental Static Regeneration (ISR) to update individual Jamstack pages without a full rebuild, balancing static performance with fresh content.
27 Jul 2026, 13:34 UTC

Problem: Full Rebuilds Slow Content Updates
In a traditional Jamstack build every content change triggers a complete static site generation. As the site grows to hundreds or thousands of pages, a single edit can take minutes or hours, delaying publishing and increasing CI/CD costs.
Takeaway: Incremental Static Regeneration (ISR) lets you update individual pages in the background while keeping the rest of the site static, reducing the need for full rebuilds.
Prerequisites
- A Jamstack framework that provides ISR (e.g., Next.js versions that include the feature; consult your framework’s documentation for exact support).
- A headless CMS or external API that supplies the page data.
- A deployment platform that offers edge caching and the ability to run serverless functions or on‑demand revalidation (e.g., Vercel, Netlify, Cloudflare Pages).
Configuring the Revalidation Cycle
ISR works by assigning a time‑to‑live (TTL) to a route. When a request arrives for a page whose cached copy is older than the TTL, the server serves the stale copy while starting a background regeneration. Once the regeneration finishes, the cache is updated.
Example Configuration (Next.js Pages Router)
In a dynamic route file such as pages/posts/[id].js, the revalidate option inside getStaticProps defines the TTL in seconds.
export async function getStaticProps({ params }) {
const res = await fetch(`https://api.example.com/posts/${params.id}`);
if (!res.ok) {
// Let Next.js handle missing pages (e.g., 404)
return { notFound: true };
}
const post = await res.json();
return {
props: { post },
// Attempt background regeneration at most once every 60 seconds
revalidate: 60,
};
}
If you are using the Next.js App Router, the equivalent is to add revalidate: 60 to the fetch call or use the revalidatePath function; refer to the App Router documentation for the exact syntax.
Diagnostic Decision: Choosing a TTL
Select the revalidate value based on how fresh the data needs to be and the load your API can handle.
| Content type | Suggested TTL | Trade‑off |
|---|---|---|
| Breaking news, stock prices | 1–10 seconds | Higher API request rate; near‑real‑time updates. |
| Blog posts, documentation | 3600 seconds (1 hour) | Lower API load; edits appear within the hour. |
| Legal pages, About Us | 86400 seconds (24 hours) | Minimal API load; updates once per day. |
Verification Procedure
Because ISR updates the cache in the background, a single refresh may not show the new content. Use the following steps to confirm the background regeneration works.
- Deploy: Set a short TTL (e.g., 10 seconds) and deploy to your production environment.
- Initial load: Visit the page to ensure it is served from the edge cache.
- Modify: Change a field in your headless CMS and save.
- First refresh: Reload the page. You should still see the old content; the server is serving the stale copy while triggering a background regeneration.
- Second refresh: Reload again. If the background regeneration finished, you should now see the updated content.
- Check logs (optional): Look at your platform’s function logs for a regeneration trigger after the first stale request.
Operational Limitations and Risks
- Stale‑while‑revalidate: The first user to request an expired page sees the previous version. If any stale data is unacceptable (e.g., flash‑sale pricing), consider Server‑Side Rendering (SSR) instead.
- API load: Aggressive TTL values combined with traffic spikes can increase requests to your CMS. Implement rate limiting, a caching layer, or use a higher TTL for less‑critical pages.
- Global inconsistency: When a site‑wide element (like a footer) changes, pages with different TTLs will update at different times, potentially showing a mix of old and new versions until all caches are refreshed.
Rollback Strategy
ISR modifies the edge cache, not the source code. Reverting a content change in the CMS does not automatically purge already‑cached pages.
- Revert the erroneous data in your CMS to the previous known‑good value.
- If your platform provides an on‑demand revalidation or cache‑purge API, invoke it for the affected routes to force a fresh regeneration.
- If such an API is not available, you may need to purge the cache via your platform’s cache‑clear tool or trigger a full site redeploy to invalidate all edge‑cached pages.
Consult your hosting provider’s documentation for the exact cache‑purge or redeploy steps.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.