Skip to main content
CMSquestions

How to Set Up On-Demand Revalidation with a CMS

AdvancedQuick Answer

TL;DR

On-demand revalidation lets you rebuild specific static pages the moment content changes in your content management system, without rebuilding the entire site or waiting for a time-based interval. Configure a webhook in your CMS to fire when content is published, point it at a revalidation API route in your frontend framework, and map document changes to the exact pages that need refreshing. The result: static site performance with content that updates in seconds.

Key Takeaways

  • On-demand revalidation targets specific pages or cache tags, unlike full rebuilds which regenerate everything
  • Next.js provides `revalidatePath()` (by URL) and `revalidateTag()` (by cache tag) for precise invalidation
  • A CMS webhook triggers revalidation—no polling, no timers, no manual deploys
  • Map document types to affected URLs: a changed `post` document should revalidate its own page plus any listing pages that include it
  • Handle edge cases: referenced content changes, bulk publishes, and failed revalidations need explicit strategies