Updating the Site Without a Redeploy
Fix a typo in the CMS, and the live page follows. The moving parts are a cache tag, a secret and a webhook.
The goal
Edit a post in the CMS and see the change on the live site, without pushing code.
Two ways it happens
- Wait. Cached data is refreshed in the background after five minutes.
- Ask. Call the revalidate route and the next visitor gets fresh data.
curl -X POST https://your-site/api/revalidate \
-H "Authorization: Bearer $REVALIDATE_SECRET"
Automating the ask
Onttle can send a webhook when a row in a table is created, updated or deleted. Point it at the revalidate route, add the Authorization header, and publishing becomes the trigger.
Limits
The route clears everything tagged posts, not a single page. For a small blog that is fine. Search results also depend on Vector sync, which is a separate step.