Post Image
githubNov 15, 2026

How to Publish Content to a Next.js Site Without a Redeploy, Using Sanity and Vercel

Ruchi Yadav
Ruchi Yadav4 min read

Publishing an article should not need a new build. With Sanity, Next.js and Vercel, a published document can update the live site within seconds. This post explains the setup: a page cache with a time limit, a webhook that fires on publish, and a route that clears only the pages that changed.

Why a Full Redeploy Is the Wrong Tool for Content

A redeploy works, but it is slow and wasteful for a text change. Every publish starts a new build and uses build minutes. The site shows old content until the build ends. On plans with limited concurrent builds, several publishes can queue behind each other. Content changes are small and frequent, so they need a lighter path.

The Three Parts of the Setup

1. Time-Based Caching

Pages are cached for a fixed time, for example one hour, using Incremental Static Regeneration. This gives fast page loads. Without the next two parts, visitors would see old content for up to one hour after you publish.

2. A Webhook in Sanity

Sanity sends an HTTP POST request to your site when a document is created, updated or deleted. The request carries a signature that is built with a shared secret. You set the URL, the dataset and the secret in the project settings on sanity.io/manage.

3. A Revalidation Route in the App

The app has a route, for example /api/revalidate. The route checks the signature, reads the document type from the request body, and clears the cached pages or tags that belong to that type. The next visitor then gets fresh content, and the page is cached again.

Map Each Document Type to the Pages It Affects

Do not clear the whole site on every change. Keep a small table in code that links each document type to its pages. An example for a personal site:

  • post: the home page, the post list and the category pages
  • postCategory: the home page and the category pages
  • author: the home page and the about page
  • Any other type: one shared cache tag as a safe fallback

Security Checklist

  • Verify the signature on every request and return a 401 response when it is not valid.
  • Store the secret as an environment variable and mark it as sensitive in Vercel, so it cannot be read again in the dashboard.
  • Separate your tokens: use a read-only token to fetch content, and keep any write token on the server only.
  • Revalidate by document type and do not trust other values in the request body to choose paths.

How to Confirm It Works

Publish a document in Sanity, then open the page on your live domain. If you still see the old version, check the delivery log of the webhook in Sanity. A failed delivery shows the status code, which tells you whether the problem is the URL, the secret or the route. A simple fix for a missed update is to publish again with a small change, because the webhook fires on every update.

When a Deploy Hook Is the Better Choice

If your site is fully static and has no revalidation route, use a Vercel Deploy Hook instead. It is a URL that starts a new build when Sanity calls it. It needs no code, so it is the simplest option. The cost is a full build on every publish. Choose it when content changes are rare or when you do not want to maintain a route.

Summary

Use a time-based cache for speed, a signed webhook for instant updates, and a small route that clears only the affected pages. This keeps publishing fast, keeps build usage low, and lets editors or automation publish content without touching the code.