← Blog
SEOIndexNowCloudflareAutomation

IndexNow x Cloudflare Pages — Instant URL submissions from sitemap.xml

5 min read

Go deeper on this topic

TanStack Start × Cloudflare

Full-stack setup with TanStack Start and Cloudflare Pages, plus Tailwind v4 migration

Article 4 of 4 in this series.

View topic page

Use the topic hub as a map, then continue to the next article in the series. New here? Start at the home hub →

IndexNow x Cloudflare Pages — Instant URL submissions from sitemap.xml

When you publish a new page, the slowest part is often waiting to be discovered.

IndexNow is a protocol for notifying search engines that a set of URLs has changed.
On sakimyto.com, the practical workflow is: treat sitemap.xml as the source of truth and submit it right after a Cloudflare Pages deploy.

This post focuses on a repeatable implementation, not theory.

TL;DR

  • Use sitemap.xml as the single URL source (avoid double bookkeeping)
  • IndexNow keys are not secrets (ownership is proven via a public file)
  • Submit after deploy, not before (URLs must be live)

Minimal mental model

IndexNow requires you to prove you control the host:

  • Serve https://<HOST>/<KEY>.txt at the site root (the body is the KEY itself)
  • Include key and keyLocation in the submission payload

In this repo, those live here:

  • src/config/indexnow.ts
  • public/<KEY>.txt

Implementation: read sitemap.xml and submit URLs

The workflow stays robust if you never manually maintain the URL list.
Instead, read public/sitemap.xml, extract <loc> entries, dedupe, and submit.

This repository uses:

  • scripts/submit-indexnow.ts

Two important design choices:

  1. Build the URL list by parsing sitemap.xml
  2. Exit non-zero on IndexNow failures so CI can detect outages

At the same time, sitemap generation and IndexNow submission are intentionally separated so a third-party outage won't block sitemap commits.

When to submit on Cloudflare Pages

The most common mistake is submitting before deployment.
If a crawler checks the URL and sees a 404 or old content, you've wasted the notification.

Recommended order:

  1. bun run generate:seo (sitemap / feed / llms)
  2. bun run build (build + typecheck)
  3. Deploy to Cloudflare Pages
  4. Run bun run submit:indexnow after deploy

This keeps your public URLs aligned with what you submit.

Extra wins (only the ones that matter)

1) Always expose your sitemap in robots.txt

In public/robots.txt, ensure you have:

Sitemap: https://sakimyto.com/sitemap.xml

2) Keep sitemap URLs aligned with canonicals

Your sitemap should match your canonical URLs. For multilingual sites, also keep hreflang consistent to avoid indexing confusion.

  • docs/runbooks/indexnow-setup.md (key generation + verification)
  • scripts/generate-seo.ts (sitemap / llms / feed generation)
  • scripts/submit-indexnow.ts (IndexNow submission)

If you ship content regularly, removing the "discovery waiting time" is one of the highest-leverage small automations you can add. The simplest version is: submit automatically after each deploy.

FAQ

Q. Is an IndexNow key secret?
No. An IndexNow key is a public identifier. You prove host ownership by serving a text file named after the key at the site root.
Q. Does IndexNow replace Google Search Console?
No. IndexNow primarily targets engines like Bing and Yandex. Google doesn't support IndexNow, so you still use GSC separately.
Q. What's the simplest way to build the URL list to submit?
Use sitemap.xml as the source of truth. It keeps the submitted list aligned with your canonical public URLs and avoids missing newly published pages.