Yukesh ChaudharyFounder · Niguro
Say namaste

Insights /Guide

Sitemaps, robots.txt and IndexNow: how to talk to search engines

What XML sitemaps, robots.txt and IndexNow each do and don't do, the limits and mistakes that matter, and a checklist to set all three up properly.

Sitemaps, robots.txt and IndexNow, by Yukesh Chaudhary

A lot of indexing problems on small sites come from mixing up three files that do very different jobs. A sitemap lists the URLs you want found. A robots.txt file says where crawlers may go. IndexNow tells participating search engines, right now, that something changed. None of them makes a page rank, and none of them on its own removes a page from search.

Get them right and crawlers spend their time on your real pages, notice updates quickly and skip the junk. Get them wrong and you can hide your whole site, or keep a page in the index that you thought you had blocked. The fixes are usually a few lines.

This guide covers what each file does and doesn’t do, the rules and limits that matter, the common mistakes, and how I set them up on my own sites. It sits in my series on how search engines work, and there’s a checklist at the end.

What sitemaps, robots.txt and IndexNow each do

XML sitemaprobots.txtIndexNow
JobLists URLs you want crawled and indexedAllows or blocks crawling of pathsPushes a notice that specific URLs changed
How it worksCrawlers fetch it on their own scheduleCrawlers read it before crawlingYou send it the moment something changes
Controls indexing?No, it’s a hintNo, it controls crawling onlyNo, it speeds up discovery
Used by Google?YesYesNo
Used by Bing and Yandex?YesYesYes

The word that keeps coming up is “hint”. Search engines decide what to crawl, what to index and what to rank. These files feed that decision; they don’t override it. If you want the bigger picture of where crawling ends and indexing begins, read how crawling, indexing and ranking work first.

XML sitemap rules and limits

A sitemap is an XML file listing your canonical URLs, optionally with the date each was last meaningfully changed. Google’s documentation on building a sitemap sets the rules most engines follow:

  • One sitemap can hold at most 50,000 URLs or 50MB uncompressed, whichever comes first. Gzip is allowed, but the 50MB limit applies to the uncompressed size.
  • The file must be UTF-8 encoded.
  • Use full absolute URLs (https://www.example.com/page, not /page).
  • Google ignores <priority> and <changefreq>, so don’t spend time tuning them.
  • List only URLs you want indexed: the canonical version, returning 200, not blocked by robots.txt, not marked noindex.

That last rule is the one people break. A sitemap full of redirects, 404s, parameter variants and noindexed pages tells a search engine your sitemap can’t be trusted. If you’re trying to work out why Google skips some of your pages, a messy sitemap is one of the first things I’d check, along with the other causes in why Google isn’t indexing your pages.

Sitemap index files

When you pass the limits, or you just want separate files for posts, pages and products, use a sitemap index: a small XML file that lists other sitemap files. You submit the index once, in Search Console, Bing Webmaster Tools or Yandex Webmaster, and add it to robots.txt. Splitting by content type also makes reports more useful, since you can see that, say, products are indexed well and tag pages are not.

Be honest with lastmod

Google says it uses <lastmod> only when the value is consistently and verifiably accurate, and that it should reflect the last significant update to the page. When Google retired its sitemap ping endpoint in 2023, it pointed site owners to accurate lastmod values as the way to signal changes. Changing the main text, structured data or links counts. A new footer, a changed sidebar widget or a fresh copyright year doesn’t.

The common failure is a generator that stamps every URL with today’s date on every build. After a few rounds of that, Google has good reason to ignore your lastmod entirely. On Siri Commands, a static Astro site I built, each build fingerprints the actual text of every page and only gives a new lastmod to pages whose text really changed. A rebuild that only touches the layout leaves every date alone. That’s the standard I’d aim for on any site.

robots.txt syntax and common mistakes

robots.txt lives at the root of the host (https://www.example.com/robots.txt) and applies only to that host and protocol. Google supports four fields: user-agent, allow, disallow and sitemap. A simple, sensible file looks like this:

User-agent: *
Disallow: /cart/
Disallow: /search?
Allow: /search?q=help

Sitemap: https://www.example.com/sitemap.xml

A few details from Google’s robots.txt specification that trip people up:

  • When rules conflict, the most specific one (the longest matching path) wins. If an allow and a disallow are equally specific, Google uses the less restrictive one.
  • * matches any run of characters and $ marks the end of the URL, so Disallow: /*.pdf$ blocks PDFs.
  • Google reads only the first 500 KiB of the file and ignores the rest.
  • Google usually caches robots.txt for up to 24 hours, so changes are not instant.
  • If robots.txt returns a 4xx error, Google treats the site as having no restrictions. A 5xx or 429 error is different: Google pauses crawling, then falls back to the last good copy for up to 30 days.
  • crawl-delay is not supported by Google. Other engines treat it differently, and Yandex now points owners to its Webmaster crawl rate setting instead.

Don’t block CSS and JavaScript

Google renders pages much like a browser does. If robots.txt blocks your stylesheets, scripts or image folders, Google may see a broken or empty page and judge it on that. Old WordPress advice to disallow /wp-includes/ or /wp-content/ causes exactly this. Block private areas and endless URL spaces, not the files your pages need to render.

noindex in robots.txt doesn’t work

Some sites still have Noindex: /old-section/ lines in robots.txt. Google never documented that rule and stopped honoring it on September 1, 2019. To keep a page out of the index, use a noindex robots meta tag in the HTML or an X-Robots-Tag: noindex HTTP header, or return 404 or 410 if the page is gone.

Diagram of how search engines use a sitemap to find URLs, robots.txt to decide what to crawl, noindex to decide what to index, and IndexNow to learn about changes.

Disallow vs noindex: which one to use

This is the mistake with the biggest consequences, so it gets its own section. Disallow stops crawling. Noindex stops indexing. They don’t combine the way people expect.

If you disallow a URL, the crawler never fetches it, which means it never sees a noindex tag on it. The URL can still end up in the index if other pages link to it, usually shown with no description. Yandex says the same in its own robots.txt help: to remove a page from search, use noindex and don’t block that page in robots.txt.

  1. Want a page out of search results? Allow crawling and add noindex. Wait until it drops out.
  2. Want to save crawl effort on pages that should never be indexed anyway, like internal search results or filter combinations? Disallow them.
  3. Page deleted for good? Return 410 or 404 and remove it from the sitemap.
  4. Duplicate of another page? Use a canonical tag (below) or a redirect.

On this site, I recently removed about 85 thin news-style posts to keep it focused. They return 410 Gone rather than redirecting somewhere unrelated, they’re out of the sitemap, and nothing in robots.txt blocks them, so crawlers can see that they are gone on purpose.

Canonical tags, briefly

A canonical tag (<link rel="canonical" href="..."> in the head) tells search engines which URL is the main version when several URLs show the same or nearly the same content: tracking parameters, sorted product lists, print versions, http and https copies. Google treats it as a strong signal, not a command, and weighs it alongside redirects, internal links and sitemap entries. Its guide to consolidating duplicate URLs covers the details.

The practical rule is consistency. The canonical URL, the URL in your sitemap and the URL in your internal links should all be the same one. When they disagree, the search engine picks for you.

IndexNow: which engines support it and how to set it up

IndexNow was launched by Microsoft Bing and Yandex in October 2021. Instead of waiting for a crawler to come back, your site sends a short request listing the URLs that were added, updated or deleted. According to the IndexNow FAQ, the participating engines as of December 2026 are Bing, Yandex, Naver, Seznam.cz, Yep and Amazon, and a submission to any one of them is shared with all the others. Check that page for the current list.

Google does not support IndexNow. It said in 2021 that it would test the protocol, but it hasn’t joined. For Google you still rely on accurate sitemaps, good internal links and, for the odd urgent page, the URL Inspection tool in Search Console.

Setting up the IndexNow key file

  1. Generate a key of 8 to 128 characters using only letters, numbers and hyphens.
  2. Save a UTF-8 text file named after the key, for example a1b2c3d4e5f6.txt, containing only the key, and upload it to the site root. If it has to live in another public folder on the same host, pass its address as keyLocation in each request.
  3. Send changed URLs to an endpoint such as https://api.indexnow.org/indexnow. One URL can go as a simple GET request; batches go as a JSON POST with your host, key and a list of up to 10,000 URLs.
  4. Read the response. A 200 means accepted. A 202 on your first request means the key is being verified. A 400 points to a bad request, 422 means it couldn’t be processed (often URLs that don’t belong to the host), and 429 means you are sending too much.
  5. Send only URLs that actually changed. Don’t resubmit the whole site on every deploy.

The automation is what makes it worth doing. On Siri Commands, every deploy takes the list of pages whose fingerprint changed and pings IndexNow with just those URLs, so the same honest change list feeds both the sitemap’s lastmod and IndexNow. I wrote about that build in the Siri Commands launch post. On this WordPress site, publishing or updating a post sends its URL automatically. IndexNow matters even more if you care about Yandex, as I explain in the Yandex SEO guide.

WordPress core sitemaps

Since WordPress 5.5, WordPress has generated sitemaps without any plugin. The index lives at /wp-sitemap.xml and links to sub-sitemaps for posts, pages, public custom post types, taxonomies and author archives. Each sub-sitemap holds up to 2,000 URLs by default, which you can change with the wp_sitemaps_max_urls filter. Since WordPress 6.5, entries for individual posts include a lastmod date based on the post’s modified time.

Core sitemaps are good enough for most sites, and this site uses them with no SEO plugin. Two things I’d still do. First, trim what’s included: author archives on a single-author site and thin tag pages usually don’t belong, and core has filters to remove them. Second, remember that the post modified time changes on any edit, including a typo fix, so if you care about lastmod honesty, avoid mass re-saving old posts for no real change. If you install an SEO plugin that makes its own sitemap, it normally turns core sitemaps off, so make sure only one is submitted.

How you group content into sections also shapes what your sitemaps look like. My free book SEO Simply: Organize and Grow Your Website goes into structure in more depth.

Checklist for sitemaps, robots.txt and IndexNow

  • Sitemap lists only canonical, indexable URLs that return 200.
  • Each sitemap stays under 50,000 URLs and 50MB uncompressed; larger sites use a sitemap index.
  • lastmod changes only when the main content really changes.
  • Sitemap submitted in Search Console, Bing Webmaster Tools and Yandex Webmaster, and listed in robots.txt.
  • robots.txt returns 200, is under 500 KiB, and doesn’t block CSS, JavaScript or images.
  • No noindex rules in robots.txt; noindex lives in meta tags or headers.
  • Pages you want removed are crawlable and noindexed, or return 404 or 410.
  • Canonical tags, sitemap URLs and internal links all point to the same version of each page.
  • IndexNow key file is live at the root, and changed URLs are pinged automatically on publish or deploy.
  • On WordPress, only one sitemap system is active and unneeded sub-sitemaps are removed.

FAQ

Does a sitemap help my pages rank?

Not directly. A sitemap helps search engines find and recrawl your URLs, which matters most for new sites, large sites and pages with few internal links. Ranking still depends on the page itself and the signals around it.

Can I use robots.txt to remove a page from Google?

No. Disallow only stops crawling, and a blocked URL can still be indexed if other pages link to it. Allow crawling and add a noindex meta tag or header, or return 404 or 410 if the page is gone.

Does Google support IndexNow?

No. Google tested the idea in 2021 but has not joined. IndexNow pings reach Bing, Yandex, Naver, Seznam.cz, Yep and Amazon, while Google relies on its own crawling and your sitemap.

Should I still ping Google with my sitemap?

No. Google deprecated its sitemap ping endpoint in 2023, and requests to it now fail. Submit the sitemap in Search Console, list it in robots.txt and keep lastmod accurate.

What is the maximum size of a sitemap?

50,000 URLs or 50MB uncompressed per file. Above that, split into several sitemaps and list them in a sitemap index. WordPress core sitemaps split much earlier, at 2,000 URLs per file by default.

These three files are only the first conversation you have with a crawler. For the rest of the story, from discovery to ranking, see the how search engines work hub.

Add to preferred sources

Leave a Reply

Your email address will not be published. Required fields are marked *

More from Guide

All in topic

Keep exploring