IndexNow on Vercel when Vercel sends no deploy events
How I made a static Astro site tell Bing about every changed page after each deploy, with a GitHub Action and a three-minute wait.
Google finds new pages on my site through the sitemap in Search Console. Bing is slower. A new log entry or case could sit for days before Bing even looked at it, and Bing also feeds Copilot and part of the AI search tools. So I set up IndexNow: after every deploy the site tells Bing (and Yandex, Seznam, Naver, which share the protocol) exactly which pages changed.
How IndexNow works
Three parts, no account needed:
- A key file on the site, for example
/1f76...txt, that contains the key itself. It proves the requests come from the owner. - After a deploy, one POST to
api.indexnow.orgwith the host, the key, where the key file lives and the list of changed URLs. - Bing crawls those URLs first. Usually within hours instead of days.
Google does not support IndexNow. It still learns from the sitemap.
The script
A small Node script reads the list of changed files from git and turns them into page URLs:
- A changed log or case file (
src/content/log/<slug>/<lang>.md) becomes that page in its language plus the log list page. - Any other change under
src/orpublic/(layout, styles, the home page) means everything changed, so it sends the whole sitemap. - It only sends URLs that are in the live sitemap, so drafts never leak out.
The first manual run sent all 168 pages and got 202: accepted, key still being checked. The first automatic run a day later got 200 for 168 pages: key verified.
The part that did not work
My first version waited for Vercel’s “deployment succeeded” event on GitHub (deployment_status), so the ping would go out only when the new pages were live. It never fired. This project’s Vercel integration does not create GitHub deployments at all, so there is no event to listen to.
The fix is plain: run on every push to main that touches src/, public/ or the Astro config, wait 180 seconds for Vercel to build (it takes under a minute here), then diff the push and send the pages. Not elegant, but it has nothing to break.
One more trap: the git token I push with had no workflow scope, so GitHub refused to accept a new file under .github/workflows/. I added that one file through the GitHub web editor instead.
Worth stealing
If you deploy a static site on Vercel or Netlify, IndexNow is twenty lines of code and one key file. Send only what changed, check against the live sitemap so drafts stay private, and do not count on deploy events unless you have seen them arrive.