Clear Cache on Build Hook

Hello. I’m using Eleventy with Sanity as CMS. I’m having a problem and is that p

The problem I’m having is that posts I delete on the Sanity CMS, still show in the frontend until I do a manual “Clear cache and deploy”. I have tried:

  1. rm -rf _site && npm run build
  2. rimraf _site && npm run build

However, the posts still stay and will not go away until a manual cache clear.

Is there something like an automatic “Clear cache and deploy” which runs on build? I basically want the cache to delete on every deploy. But clearing _site doesn’t seems to do it.

Build hooks | Netlify Docs

  • clear_cache: when set to true, this parameter triggers a build with a cleared cache.