robots.txt, noindex and XML sitemaps explained: what each one really does, and how to set them up without hurting your site

TL;DR

Difficulty: Beginner

robots.txt tells crawlers where they may go. It does not keep a page out of Google, and a page it blocks can still be indexed from links.

  • noindex keeps a page out of results, but only if crawlers can read it: never block a page in robots.txt that you want deindexed.
  • A sitemap should list only canonical, indexable pages that return status 200, with an honest lastmod. Google ignores changefreq and priority.
  • In the worked example, a shop's sitemap shrinks from 11,240 URLs (21.5% useful) to 2,596 (all useful).

Three small files decide what search engines may crawl, what they may show, and what you would like them to find. Each one is usually set up once and forgotten, and each one can quietly take a healthy site out of Google. Here is what they really do, from the standard and from Google's and Bing's own documentation, with a shop's files rewritten line by line.

Three small files that decide what search engines see

Most websites carry three quiet instructions for search engines. A text file called robots.txt says where crawlers may go. A robots meta tag (or its twin, an HTTP header) says whether a page may appear in search results. An XML sitemap lists the pages you want found. All three are short, all three are usually set up once and forgotten, and each one can take a healthy site out of Google in an afternoon if it is set up the wrong way round.

This chapter explains what each of them really does, from the standard and from Google's and Bing's own documentation, and then fixes them on a real looking shop. It builds on the first chapter of this series, how search engines crawl, render and index a website, so if the words crawling and indexing still feel fuzzy, start there.

The one sentence to keep: robots.txt controls crawling, noindex controls indexing, and a sitemap is a suggestion. Almost every disaster in this area comes from mixing those three up.

Example: the shop this chapter fixes

Ashby Outdoor (an invented example) is an online shop for garden and outdoor furniture in Nottingham, run by Tom, at ashbyoutdoor.example. It sells 1,850 products in 14 categories, with filters for material, colour, size, seats and price. Organic search brings 38,000 sessions in May, its peak month, and 14,000 in January.

Google Search Console shows 4,100 pages indexed, 31,000 "Crawled, currently not indexed" and 52,000 "Discovered, currently not indexed". The server logs show Googlebot requesting about 210,000 distinct URLs in a month, most of them filter combinations, against about 2,600 URLs that are actually useful.

For this chapter I split those 2,600 useful URLs (a derived figure, labelled as such): 1,850 product pages, 540 category, subcategory and curated filter pages that carry their own copy, 180 buying guides, and 26 service and information pages (delivery, returns, assembly, contact and the like). That is 2,596, which rounds to the 2,600 in the logs.

Tom's robots.txt and sitemap were generated by his old shop platform years ago, and nobody has looked at them since. By the end of this chapter both will be rewritten, line by line.

What robots.txt is, and where it comes from

robots.txt is a plain text file at the root of a website that tells crawlers which paths they may request. It is the oldest convention on the web that search engines still follow: Martijn Koster defined it in 1994, and in September 2022 it finally became an internet standard, RFC 9309, the Robots Exclusion Protocol, written by Koster with three Google engineers1.

Three facts from the standard matter more than any others.

  • It controls crawling, nothing else. The file asks a crawler not to fetch certain URLs. It says nothing about whether those URLs may appear in search results.
  • It is a request, not a lock. The standard says plainly that the rules "are not a form of access authorization"1. Polite crawlers obey it. A scraper does not have to, and the file itself is public, so listing your secret folders in it is like taping a note to the front door saying where the spare key is.
  • It lives at one address per host. The file must sit at /robots.txt on the host it governs1. Google adds that the rules apply only to the exact host, protocol and port where the file sits, so shop.example.com needs its own file, and so does a version on a different port2.

Google says the same in its own words: robots.txt is mainly for managing crawler traffic, and it "is not a mechanism for keeping a web page out of Google"3. If you remember one quote from this chapter, make it that one.

Example: what Tom's file is for, and what it is not for

Tom has two kinds of URL he would rather search engines left alone. The first is his basket, checkout and account pages: they hold no content worth finding, and every crawler request to them is wasted. That is a crawling problem, so robots.txt is the right tool.

The second is his trade price list, a PDF for landscapers that he does not want the public to see. That is a privacy problem, and robots.txt is the wrong tool. Listing /trade/price-list.pdf in robots.txt would publish its address to anyone who opens the file, and the file would still be reachable. The right answer is a login. The rest of this chapter deals with the first kind of URL. The second kind belongs behind a password, and nowhere else.

How a robots.txt file is built

A robots.txt file is a list of groups. Each group starts with one or more User-agent lines that name the crawlers it applies to, followed by Disallow and Allow lines that name paths. Google supports exactly four fields: user-agent, allow, disallow and sitemap. Anything else, such as crawl-delay, is ignored by Google2.

Here is the smallest useful file, with comments (anything after a #):

# Applies to every crawler that has no group of its own
User-agent: *
# Do not request anything under /checkout/
Disallow: /checkout/

# Where the sitemap lives (always the full address)
Sitemap: https://www.example.com/sitemap.xml

The rules work like this, per Google's documentation and the standard21:

  • Paths are matched from the start, and they are case sensitive. Disallow: /checkout/ blocks /checkout/payment but not /Checkout/payment, and not /checkout without the trailing slash.
  • Two wildcards exist. * matches any run of characters, and $ marks the end of the URL. Disallow: /*.pdf$ blocks every URL that ends in .pdf.
  • The longest matching rule wins. If Disallow: /garden/ and Allow: /garden/benches/ both match a URL, the longer, more specific rule decides, so /garden/benches/teak may be crawled.
  • On a tie, the less restrictive rule wins. If an allow and a disallow rule match with the same length, Google allows the URL2.
  • Each crawler obeys one group only. Googlebot looks for the group that names it most specifically and ignores the rest. If there is a User-agent: Googlebot group, Googlebot does not read the User-agent: * group at all2. This catches out more sites than any other rule.
  • Size and caching have limits. Google reads the first 500 kibibytes (KiB) of the file and ignores anything after that. It usually caches the file for up to 24 hours, so a change can take a day to be noticed2.

Example: reading Tom's file as Googlebot would

This is the robots.txt Tom's old platform produced:

# ashbyoutdoor.example, BEFORE
User-agent: *
Disallow: /assets/
Disallow: /checkout/
Noindex: /search/
Crawl-delay: 10

User-agent: Googlebot
Disallow: /account/

Sitemap: http://ashbyoutdoor.example/sitemap.xml

Read it as Googlebot, line by line.

  1. Googlebot looks for the most specific group. There is a User-agent: Googlebot group, so it uses that one and ignores the * group completely.
  2. For Googlebot, therefore, only /account/ is blocked. The checkout is not blocked for Google at all, even though Tom believes it is.
  3. The Noindex: /search/ line does nothing. Google stopped supporting noindex inside robots.txt on 1 September 20194, and it was never part of the standard.
  4. Crawl-delay: 10 does nothing for Google, which ignores the field2.
  5. The Sitemap line points at the old http address. The site has run on https for years, so the line points at a redirect rather than the real file.

Now read it as any other crawler, Bingbot for example, which has no group of its own and so follows the * group. For those crawlers /assets/ is blocked. On Tom's platform that folder holds every stylesheet and every script. A crawler that renders the page without them sees an unstyled page with no product filter and no gallery. Google warned about exactly this in 2014, when it said blocking CSS and JavaScript "directly harms how well our algorithms render and index your content"5.

So one short file manages to block the wrong thing for one crawler, fail to block the right thing for another, and carry two lines that no major search engine reads.

The classic disaster: Disallow: / goes live

The most expensive robots.txt mistake is two characters long:

User-agent: *
Disallow: /

That asks every crawler to stay away from the whole site. It is the right file for a staging site, which is why it usually arrives on a live site the same way: a developer copies the staging configuration during a release, and the block goes live with it.

What happens next is quieter than people expect. Pages do not vanish overnight. Google stops crawling them, so their content stops being refreshed. Over the following days and weeks, pages that are still linked from elsewhere can stay in the index without their content: Google says a blocked page that other pages link to can still appear, but its result "won't have a description"3. Search Console then lists those pages under "Indexed, though blocked by robots.txt"6. New products are not crawled at all. Rankings slide as Google works from a stale and partial picture of the site.

The opposite failure is just as instructive. If robots.txt itself returns a server error (a 5xx status), Google does not assume the site is open. It stops crawling the whole site for the first 12 hours while it keeps retrying the file. For up to 30 days it then uses the last good copy it cached, or assumes there are no restrictions if it never had one. After 30 days it treats the file as missing if the rest of the site works, and keeps crawling paused if the site is generally unavailable2. A missing file (a 404) is harmless: Google treats it as "no restrictions"2. A broken file is not.

Tap or click to open full screen and move around

Example: a Friday release at Ashby Outdoor

Picture a release that goes wrong. On a Friday afternoon, a new theme goes live on Tom's shop, and with it the staging robots.txt containing Disallow: /. Nobody notices, because the shop looks perfect to every human visitor.

Here is the sequence, step by step, using only what Google documents.

  1. Within about a day, Google's cached copy of robots.txt expires and it fetches the new one2. From then on, Googlebot requests nothing on the site except robots.txt itself.
  2. Tom adds 40 new lounge sets for the summer on Monday. None of them is crawled, so none of them can be indexed.
  3. Existing product pages stay in the index for now, but Google cannot refresh them. Prices and stock in the results drift away from reality.
  4. As Google reprocesses pages, some appear in Search Console as "Indexed, though blocked by robots.txt", with almost no snippet. Others drop out.
  5. Ten days later, a dip in organic orders in May, the peak month, finally prompts someone to look.

The fix takes a minute: restore the correct file, then open the robots.txt report in Search Console, which shows the file Google last fetched for each host and lets you request a recrawl of it7. Recovery takes longer, because every blocked page has to be crawled again. The prevention is boring and reliable: the release process checks the live robots.txt after every deploy and fails loudly if it contains Disallow: /. Staging sites should sit behind a password anyway, which keeps out people as well as crawlers.

Blocking crawling does not keep a page out of Google

This is the misunderstanding at the heart of most robots.txt trouble, so it deserves its own section.

When you disallow a URL, you stop Google from reading it. You do not stop Google from knowing it exists. If other pages link to it, inside your site or elsewhere, Google can still index the bare URL, using the link text to guess what it is about3. The page indexing report in Search Console has a status for exactly this: "Indexed, though blocked by robots.txt", where Google notes that such results usually show a very limited snippet6.

There is a second, nastier consequence. Because Google never fetches a disallowed page, it never sees anything written on that page, including a noindex tag. Google's documentation is explicit: for noindex to work, the page "must not be blocked by a robots.txt file"8. Block the page and add noindex, and the noindex is simply never read.

Example: Tom's internal search pages

Tom's shop has an internal search, and its result pages (/search?q=teak+bench and thousands like it) have crept into Google's index. Assume, as a derived figure for this example, that 1,400 of his 4,100 indexed pages are search results. They are thin, they compete with his real category pages, and he wants them gone.

His first instinct is to do both things at once: add a noindex tag to the search template and add Disallow: /search to robots.txt. Walk through what Google does.

  1. Google fetches the new robots.txt and stops requesting any URL under /search.
  2. Because it no longer requests those pages, it never sees the new noindex tag.
  3. The 1,400 pages it had already indexed stay indexed, now without fresh content, many of them listed as "Indexed, though blocked by robots.txt".

The order that works:

  1. Add the noindex tag to the search results template. Leave robots.txt alone, so Google can still crawl those pages.
  2. Wait while Google recrawls them. In the page indexing report, watch the count of search URLs move into the noindex status. Google warns that a recrawl can take months for some pages8, which is why patience, not a second rule, is the tool here.
  3. Once they have dropped out, add Disallow: /search if crawlers are still spending many requests there. Now the block saves crawling without trapping anything in the index.

Meta robots and the X Robots Tag header

The robots meta tag sits in the head of an HTML page and tells search engines what they may do with that page once they have crawled it. The same instructions can be sent as an HTTP response header called X-Robots-Tag, which is the only way to apply them to files that have no HTML head, such as PDFs and images9.

<!-- In the <head> of a page: keep this page out of search results -->
<meta name="robots" content="noindex">

<!-- The same rule, for Google's crawlers only -->
<meta name="googlebot" content="noindex">
# The same rule as an HTTP response header, for example on a PDF
X-Robots-Tag: noindex

Google's specification lists the rules it supports9. These are the ones that matter for a typical business website, as documented at the time of writing (June 2025):

RuleWhat it doesWhen to use it
noindexKeeps the page out of search resultsThank you pages, internal search results, thin duplicates you cannot remove
nofollowAsks Google not to follow the links on the pageRarely: pages full of links you do not vouch for
noneSame as noindex and nofollow togetherRarely
nosnippetNo text snippet or video preview. Google also documents it as keeping the page from being used directly in AI Overviews and AI ModePages whose text must never be quoted in the results
max-snippet:[number]Caps the snippet at that many characters. 0 means no snippet, minus one means no limitFine control over quoting
max-image-preview:[setting]Sets the image preview size: none, standard or largeProduct images you want shown large in results
noimageindexKeeps the images on the page out of image resultsRarely
unavailable_after:[date]Drops the page from results after the given dateEvent pages, time limited offers
noarchiveNo longer used by Google Search, since Google's cached page link is goneLeave it out of new templates

A few behaviours are worth knowing9:

  • When rules conflict, the more restrictive one applies. nosnippet beats max-snippet:50.
  • Rules can be combined with commas in one tag, or spread across several tags.
  • The tag only works if the page is crawled. Meta robots and X-Robots-Tag are read during crawling. If robots.txt blocks the URL, they are never seen.
  • Other engines may differ. Google itself notes that some search engines may interpret noindex differently8, so check each engine you care about.

Google's documentation history shows how this list moves. Google moved noarchive into a historical section in October 2024 and archived the nositelinkssearchbox rule in November 2024, after the features behind them were retired. In March 2025 it added AI Mode to the description of the snippet controls10. So treat the table above as correct for June 2025, and check the specification again before you build a template around a rare rule.

Example: noindex on Tom's thank you page and his PDFs

Tom has three noindex jobs.

  1. The newsletter confirmation page (/newsletter/thanks). Nobody should land on it from Google. Tom adds <meta name="robots" content="noindex"> to the template and leaves the page crawlable, so Google can see the tag. (His order confirmation page sits under /checkout, which robots.txt will block, so it needs no tag of its own as long as it was never indexed.)
  2. The assembly instructions. His 1,850 products come with about 900 PDF assembly guides (a derived figure for this example). He wants those found, because people search for "how to assemble" a specific bench, so they get no noindex at all.
  3. Old printed catalogues. Twelve PDF catalogues from past seasons still sit on the server, with old prices. A PDF has no head for a meta tag, so the web server sends a header instead. On Nginx that is one line in the location block for the catalogue folder:
# Nginx: keep the old PDF catalogues out of search results
location /media/catalogues/ {
    add_header X-Robots-Tag "noindex" always;
}

After the change, Tom checks one catalogue with the URL Inspection tool in Search Console, which shows the response Google receives, header included8.

Block crawling or block indexing: which one you need

With both tools explained, the decision becomes simple. Ask what you are actually trying to achieve.

  • If the page must stay private, neither tool is enough. Use a login.
  • If the page should not appear in results but may be crawled, use noindex.
  • If crawlers waste many requests on URLs that have no value, and those URLs are not in the index, use robots.txt.
  • If the page is a duplicate of another page, the answer is usually a canonical tag or a redirect, which the next chapter of this series, on canonical tags and duplicate content, explains in full.

Google's own guide on crawl budget makes the same split for large sites: block unimportant URLs with robots.txt, and do not use noindex to save crawling, because Google still has to request the page before it can see the tag11. The same guide warns against using robots.txt to free up crawling temporarily, since Google only shifts that capacity elsewhere if the site is already at its crawl limit11.

Tap or click to open full screen and move around

Example: Tom's four kinds of unwanted URL, sorted

Tom lists every kind of URL he does not want in search and runs each through the flow.

URL typePrivate?Duplicate?Already indexed?Crawl waste?Decision
Trade price list PDFYesNoNoNoLogin, then nothing else needed
Basket, checkout, accountNoNoNoYesDisallow in robots.txt
Internal search resultsNoNoYes, 1,400Yesnoindex first, Disallow once they drop out
Filter and sort combinationsNoYes, of the categoryA fewYes, most of the 210,000Disallow for parameter combinations, curated pages stay open

The last row is the big one, and it is also the subject of its own chapter later in this series, on faceted navigation, filters and pagination. For now, one fact from Google is enough: in December 2024 Google called faceted navigation "by far the most common source of overcrawl issues" that site owners report, and its documentation recommends disallowing filter URLs in robots.txt when they do not need to be indexed1213.

Tom's robots.txt, rewritten

Here is the file after the clean up, with every line explained in a comment. The curated filter pages that carry their own copy (such as /garden-benches/teak) use clean paths without parameters, so they stay open. Only the parameter versions of the filters are blocked. Pagination (?page=2) stays open, so crawlers can still reach every product through the category pages.

# ashbyoutdoor.example, AFTER
# One group for every crawler. No separate Googlebot group,
# so every crawler reads the same rules.
User-agent: *

# Basket, checkout and account: no search value, pure crawl waste.
# No trailing slash, so /checkout itself is covered as well.
Disallow: /basket
Disallow: /checkout
Disallow: /account

# Filter and sort parameters, in any position in the query string.
# Curated filter pages use clean paths and are not affected.
Disallow: /*?*sort=
Disallow: /*?*material=
Disallow: /*?*colour=
Disallow: /*?*size=
Disallow: /*?*seats=
Disallow: /*?*price=

# Internal search: added in week six, AFTER the noindexed
# search pages had dropped out of the index.
Disallow: /search

# Stylesheets and scripts under /assets/ are no longer blocked.
# Noindex and Crawl-delay lines removed: Google ignores both.

Sitemap: https://ashbyoutdoor.example/sitemap_index.xml

Prefix matching cuts both ways, so Tom also checks that no product or category path starts with /basket, /checkout or /account. A range of rattan basket chairs at /basket-chairs would otherwise vanish from every crawler's view.

Before the file goes live, Tom tests it. The robots.txt report in Search Console shows whether Google fetched and parsed the file and flags errors7, and the URL Inspection tool shows whether a specific URL is blocked. Tom checks five URLs by hand: a product, a category, a curated filter page, page two of a category, and one filter combination. Only the last one should come back as blocked.

What an XML sitemap is, and what it is not

An XML sitemap is a file that lists the URLs on your site you want search engines to know about, optionally with the date each one last changed. The format is defined at sitemaps.org, a protocol that Google, Bing and other engines share14.

Google describes a sitemap as a way to tell it which pages and files you think are important, and when they were last updated15. It is careful about the limits: a sitemap helps discovery, it does not guarantee that anything will be crawled or indexed, and Google calls a submitted sitemap "merely a hint"16. Leaving a URL out of the sitemap does not stop Google from crawling it either15.

Who needs one? Google says a sitemap helps most on large sites, new sites with few links from outside, and sites with lots of images, video or news. A site of about 500 pages or fewer, well linked internally, may not need one at all15. A shop with 1,850 products and 14 categories is well past that line.

The basic file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <!-- The full, absolute, canonical address -->
    <loc>https://www.example.com/garden-benches/teak-bench-150</loc>
    <!-- When the page's content last changed, not when this file was built -->
    <lastmod>2025-05-28</lastmod>
  </url>
</urlset>

The rules from the protocol and from Google1416:

  • Absolute URLs only. Each loc holds the full address, with protocol and host, under 2,048 characters.
  • Same host and protocol. A sitemap can only list URLs on its own host, with the same protocol. A sitemap placed in a folder covers only that folder and below, unless you submit it through Search Console, so the root is the safe place.
  • Limits per file. At most 50,000 URLs and 50MB uncompressed. Gzip compression is allowed, but the limit applies to the uncompressed size.
  • Encoding. The file must be UTF-8, and characters such as & inside URLs must be escaped as &amp;.
  • changefreq and priority are ignored by Google. Google says it "still doesn't use the changefreq or priority elements at all"17. Bing has said it largely ignores them too, because sites set them to the same value everywhere18.

What belongs in a sitemap

A sitemap is a list of answers to one question: which URLs would I be glad to see in search results? That rules out far more than most generated sitemaps do. Google's guidance is to list the URLs you want shown in search, which are generally the canonical ones16. In practice a URL belongs in the sitemap only if all of these are true:

  • It returns a 200 status, not a redirect and not an error.
  • It is the canonical version of its content, not a duplicate pointing elsewhere.
  • It carries no noindex.
  • It is not blocked by robots.txt.
  • It is a page you would want a stranger to land on.

Every URL that fails one of these tests sends a mixed signal. You are telling Google "this matters" in the sitemap and "ignore this" somewhere else. Google copes, but it learns that your sitemap is not a reliable list.

Example: what is in Tom's old sitemap

Tom's old platform builds one file, sitemap.xml, with 11,240 URLs in it. Sorted by type (figures derived for this example), it holds:

Type of URLCountBelongs in the sitemap?
Live product pages, canonical, status 2001,850Yes
The same products again under category paths, canonical pointing elsewhere1,850No, duplicates
Discontinued products, now 404 or redirected1,320No, not status 200
Filter and sort URLs with parameters5,642No, about to be blocked
Categories, subcategories and curated filter pages540Yes
Service and information pages26Yes
Login, basket and account pages, all noindexed12No, noindexed
Buying guides0Missing: the blog runs on a separate system
Total11,240

Every lastmod value is the same date, the date the file was generated, and every URL carries <changefreq>daily</changefreq> and <priority>1.0</priority>.

Only 2,416 of the 11,240 entries belong there, and the 180 buying guides, some of the most useful pages on the site, are not listed at all.

Measuring how clean a sitemap is

Two ratios tell you how much a sitemap can be trusted. Precision is the share of listed URLs that belong in it. Coverage is the share of the URLs that belong in it that are actually listed. Both are simple ratios (Foundations: ratios and rates).

P=UgoodUlistedC=UgoodUwantedP = \frac{U_{good}}{U_{listed}} \qquad C = \frac{U_{good}}{U_{wanted}}

where PP is the sitemap's precision, CC its coverage, UgoodU_{good} the number of listed URLs that pass all five tests above, UlistedU_{listed} the total number of URLs in the sitemap, and UwantedU_{wanted} the number of URLs on the site that you want in search results.

A third ratio, from the server logs, shows how much of Google's crawling lands on pages that matter. It is the same kind of ratio (Foundations: ratios and rates):

W=UusefulUcrawledW = \frac{U_{useful}}{U_{crawled}}

where WW is the useful share of the crawl, UusefulU_{useful} the number of useful URLs on the site, and UcrawledU_{crawled} the number of distinct URLs Googlebot requested in the month.

Example: Tom's numbers, worked through

Precision before the clean up: 2,416 good URLs out of 11,240 listed.

P=2,41611,240=0.215P = \frac{2{,}416}{11{,}240} = 0.215

So PP is 21.5%: roughly one entry in five belongs in the sitemap.

Coverage before: 2,416 good URLs listed out of 2,596 wanted (the 180 guides are missing).

C=2,4162,596=0.931C = \frac{2{,}416}{2{,}596} = 0.931

So CC is 93.1%: the coverage looks fine, which is exactly why nobody noticed the guides were missing.

Useful share of the crawl: about 2,600 useful URLs against about 210,000 distinct URLs crawled.

W=2,600210,000=0.0124W = \frac{2{,}600}{210{,}000} = 0.0124

So WW is 1.2%: only about one crawler request in 80 lands on a page that matters.

In words: four out of five sitemap entries point Google at something Tom does not want indexed, and almost all of the crawling goes to filter combinations. The sitemap fix raises PP and CC to 100%, because the sitemap is fully under Tom's control. The robots.txt fix is what moves WW, and how far it moves depends on how Google recrawls the site over the following months, so Tom measures it rather than predicting it.

Grouped bars by URL type. Before: 1,850 live products, 1,850 product duplicates, 1,320 discontinued products, 5,642 filter and sort URLs, 540 category and curated pages, 0 guides, 26 service pages and 12 noindexed pages, 11,240 in total. After: 1,850 live products, 540 category and curated pages, 180 guides and 26 service pages, 2,596 in total, and nothing else. Tap or click to open full screen and move around

Getting lastmod right

lastmod is the one optional field that search engines actually use, and only if they can trust it. Google uses it when the values are "consistently and verifiably accurate"16. A significant change means the main text, the structured data or the links on the page changed. A new copyright year in the footer does not count16. Google's 2023 announcement adds that you may simply leave lastmod out for pages where you are not sure, such as a home page that aggregates other content17.

Bing is even more direct. In February 2023 its Webmaster Blog called lastmod one of the most important tags in a sitemap and said the date "must be set to the date the linked page was last modified, not when the sitemap is generated"18. Bing also published what it found across the sitemaps it knows: 84% set lastmod, but the most common error was the same date on every URL, usually the date the file was built. Bing says it may disregard dates that always match the current date18. That is Bing's own study of its own data, so read it as a description of how widespread the problem is, not as a ranking factor.

Example: where Tom's dates come from

Tom's old sitemap stamps every URL with the day the file was built. To Google and Bing, that looks like 11,240 pages changing every single day, which is obviously false, so the dates get ignored.

The fix is to take the date from the place the content lives.

  1. Product pages: the date the product's description, price, images or stock status last changed in the shop database. A price change is a change visitors care about, so it counts.
  2. Category pages: the date the category's own copy or its list of products last changed. If that is hard to track reliably, Tom leaves lastmod out for categories, as Google allows17.
  3. Guides: the date an editor last changed the article's text, taken from the blog system.
  4. Service pages: the date the page was last edited in the content system.

A shop on Ruby on Rails or Solidus can generate exactly this from the database, because every product and page record already carries an "updated at" timestamp. The only care needed is to update that timestamp for real changes, and not for a background job that touches every row overnight.

Sitemap index files and image sitemaps

When a site outgrows one file, or when you want to see different parts of the site separately, you split the sitemap and list the parts in a sitemap index file. An index file can list up to 50,000 sitemaps, each with its own lastmod, and you submit just the index1419.

Splitting has a second, very practical benefit: Search Console's page indexing report can be filtered by individual sitemap6. If products, categories and guides each have their own sitemap, you can see at a glance which group Google is reluctant to index.

Image sitemaps are an extension of the same format. They add one or more image:image entries to a page's URL, each with an image:loc, up to 1,000 images per page. The images may sit on another domain, such as a content delivery network (CDN), as long as both domains are verified in Search Console20. Google retired the extra image tags (caption, title, geo location and licence) in 2022, and they have had no effect since August of that year, so only the location is still worth sending2021.

Sitemaps can also carry the language editions of a page, using hreflang entries. That is one of the three ways Google accepts for marking up localised versions, alongside HTML tags and HTTP headers22. It gets its own chapter later in this series, on hreflang for the UK, Ireland, Germany and Austria.

Example: Tom's sitemaps after the clean up

Tom now has one index and four sitemaps:

<?xml version="1.0" encoding="UTF-8"?>
<!-- https://ashbyoutdoor.example/sitemap_index.xml -->
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://ashbyoutdoor.example/sitemaps/products.xml</loc>
    <lastmod>2025-06-09</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://ashbyoutdoor.example/sitemaps/categories.xml</loc>
    <lastmod>2025-06-02</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://ashbyoutdoor.example/sitemaps/guides.xml</loc>
    <lastmod>2025-06-06</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://ashbyoutdoor.example/sitemaps/pages.xml</loc>
    <lastmod>2025-04-14</lastmod>
  </sitemap>
</sitemapindex>

One entry in the products sitemap, with its images on the shop's CDN:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
  <url>
    <loc>https://ashbyoutdoor.example/garden-benches/teak-bench-150</loc>
    <!-- Price changed on 9 June: a real change -->
    <lastmod>2025-06-09</lastmod>
    <image:image>
      <image:loc>https://cdn.ashbyoutdoor.example/p/teak-bench-150-front.jpg</image:loc>
    </image:image>
    <image:image>
      <image:loc>https://cdn.ashbyoutdoor.example/p/teak-bench-150-side.jpg</image:loc>
    </image:image>
  </url>
  <!-- 1,849 more products -->
</urlset>

The four files hold 1,850 products, 540 category and curated pages, 180 guides and 26 service pages: 2,596 URLs, every one of them status 200, canonical, indexable and allowed by robots.txt. No changefreq, no priority. A product drops out of the sitemap on the day it is discontinued, and a new product appears on the day it goes live.

Telling search engines where the sitemap is

There are three ways to make sure search engines find your sitemap, and a fourth that no longer works.

  1. The robots.txt line. Sitemap: followed by the full URL. Google, Bing and others read it, the line can sit anywhere in the file, and you can list several1416.
  2. Google Search Console. The Sitemaps report lets you submit the sitemap or index, shows when Google last read it, and reports one of three states: Success, Has errors (some URLs could not be read, the rest are still used) or Couldn't fetch19. It also shows how many URLs Google discovered from each file. One trap: removing a sitemap from the report does not make Google forget the URLs in it19.
  3. Bing Webmaster Tools. Bing reads the robots.txt line as well, and its tools let you submit the sitemap directly. Bing's advice has long been to reference the sitemap once and then keep it current, rather than resubmitting it every time it is rebuilt23.
  4. The old ping URL, now gone. Google deprecated its sitemap ping endpoint in June 2023 and said it would stop working within six months17. Old plugins that still ping it do no harm, and no good either.

For faster notice of individual changes, there is IndexNow, an open protocol that lets a site tell participating search engines (Bing among them) the moment a URL is added, changed or deleted, with a single submission shared across all of them24. At the time of writing, Google is not among the participants. I explained how it works, and how to set it up, in IndexNow, instant indexing and crawl budget.

Example: Tom's submission checklist

  1. Update the Sitemap: line in robots.txt to https://ashbyoutdoor.example/sitemap_index.xml.
  2. In Search Console, remove the old sitemap.xml from the Sitemaps report, then make the old URL return a 404 so it cannot be read either. Submit the new index.
  3. Check that all four child sitemaps show Success, and that the discovered URL counts add up to 2,596.
  4. In Bing Webmaster Tools, submit the same index.
  5. Set the shop to send IndexNow notices when a product is added, changed or discontinued.
  6. Verify the CDN host in Search Console, so the image entries count.

What to watch after the change

None of these fixes produces an overnight jump, and anyone who promises one is guessing. What you can do is watch the right numbers, in the right places.

What to checkWhereWhat good looks like
robots.txt fetched and parsedSearch Console robots.txt reportFetched, no errors, the new version shown
Sitemaps readSearch Console Sitemaps reportSuccess on all four files
Indexing of submitted URLsPage indexing report, filtered to all submitted pagesIndexed share of the 2,596 rising over the weeks
Search pages leaving the indexPage indexing report, noindex statusCount rising towards 1,400, then stable
Crawl spreadServer logs, or the Crawl stats reportA falling share of requests on parameter URLs
RenderingURL Inspection, live testStyled page with filters and gallery visible

The page indexing report is the most useful of these, because it can show only the URLs you submitted6. If the indexed share of those 2,596 URLs stays low after a couple of months, the problem is no longer the sitemap. It is the pages themselves, or the duplicates competing with them, which is what the next chapters deal with.

Example: reading Tom's report honestly

Six weeks after the change, Tom filters the page indexing report to his products sitemap. He does not compare the total indexed count with the old 4,100, because that old number included 1,400 search pages he deliberately removed. He compares like with like: of the 1,850 products he submitted, how many are indexed now, and how many were indexed before.

That habit is worth more than any single fix in this chapter. When you clean up, totals can fall while the site gets healthier, and a report that only shows the total will tell you the opposite of the truth.

My view

My view: robots.txt and sitemaps are not where rankings are won, but they are where a lot of rankings are quietly lost, and they take less time to get right than any other part of search. An afternoon, once, done properly.

Three positions I hold, and why.

  • Keep robots.txt short and boring. Every line should have a reason a stranger could understand, written in a comment next to it. A long robots.txt is almost always a history of old problems nobody dared to delete. One group for all crawlers is easier to reason about than separate groups, unless you truly need a crawler to behave differently.
  • Never use robots.txt to hide anything, and never use it to remove pages from the index. It does neither. Use a login for the first and noindex for the second, and add a Disallow only once the noindex has done its work.
  • Treat the sitemap as a promise. Every URL in it should be one you would defend. A sitemap generated by a plugin with every URL the system knows is not a sitemap, it is a database dump. Precision matters more than size.

What is documented and what is not, so you can weigh this chapter: everything about how robots.txt, noindex and sitemaps behave comes from the standard and from Google's and Bing's own documentation, cited below. Bing's lastmod statistics come from Bing's own study of its own index. The idea that a clean sitemap earns trust that a messy one loses is my reading of Google's and Bing's statements about ignoring unreliable lastmod values. Neither engine publishes a trust score, so it is a reasonable inference, not a documented mechanism.

If your shop runs on a platform that writes these files for you, it is worth an hour to read what it actually wrote. If it is your own system, as with the online shops I build on Solidus, the files should be generated from the same database as the pages, so they can never drift apart.

Conclusion

robots.txt decides where crawlers may go, noindex decides what may appear in results, and the sitemap lists what you would like found. Each one does its own job and fails at the others.

For Tom, the fixes were small: one group in robots.txt instead of two, stylesheets unblocked, filter parameters disallowed, the noindex lines that never worked replaced by noindex where it belongs, and a sitemap that went from 11,240 entries, a fifth of them useful, to 2,596 entries, all of them useful. The changes took an afternoon. Reading the results honestly takes months.

If you would like a second pair of eyes on your own robots.txt, noindex rules and sitemaps, the free workshop is the place to start, and you can see what the work costs before we ever talk.

Want someone to read your robots.txt, noindex rules and sitemaps the way a search engine does? Book the free workshop, we go through them together, and the first two weeks of work are on me.

Sources

  1. 1.

    M. Koster, G. Illyes, H. Zeller and L. Sassman, RFC 9309: Robots Exclusion Protocol, Internet Engineering Task Force (IETF), September 2022, https://www.rfc-editor.org/rfc/rfc9309.html

  2. 2.

    Google Search Central, How Google interprets the robots.txt specification, https://developers.google.com/search/docs/crawling-indexing/robots/robots_txt

  3. 3.

    Google Search Central, Introduction to robots.txt, https://developers.google.com/search/docs/crawling-indexing/robots/intro

  4. 4.

    Gary Illyes, A note on unsupported rules in robots.txt, Google Search Central Blog, 2 July 2019, https://developers.google.com/search/blog/2019/07/a-note-on-unsupported-rules-in-robotstxt

  5. 5.

    Pierre Far, Updating our technical Webmaster Guidelines, Google Search Central Blog, 27 October 2014, https://developers.google.com/search/blog/2014/10/updating-our-technical-webmaster

  6. 6.

    Google, Page indexing report, Search Console Help, https://support.google.com/webmasters/answer/7440203

  7. 7.

    Google, robots.txt report, Search Console Help, https://support.google.com/webmasters/answer/6062598

  8. 8.

    Google Search Central, Block search indexing with noindex, https://developers.google.com/search/docs/crawling-indexing/block-indexing

  9. 9.

    Google Search Central, Robots meta tag, data nosnippet and X Robots Tag specifications, https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag

  10. 10.

    Google Search Central, Latest documentation updates (entries of 2 October 2024, 29 November 2024 and 5 March 2025), https://developers.google.com/search/updates

  11. 11.

    Google Search Central, Large site owner's guide to managing your crawl budget, https://developers.google.com/search/docs/crawling-indexing/large-site-managing-crawl-budget

  12. 12.

    Google Search Central Blog, Crawling December: faceted navigation, 17 December 2024, https://developers.google.com/search/blog/2024/12/crawling-december-faceted-nav

  13. 13.

    Google Search Central, Managing crawling of faceted navigation URLs, https://developers.google.com/search/docs/crawling-indexing/crawling-managing-faceted-navigation

  14. 14.

    sitemaps.org, Sitemaps XML format (the sitemap protocol), https://www.sitemaps.org/protocol.html

  15. 15.
  16. 16.
  17. 17.

    Gary Illyes, Sitemaps ping endpoint is going away, Google Search Central Blog, 26 June 2023, https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping

  18. 18.

    Fabrice Canel, The importance of setting the lastmod tag in your sitemap, Bing Webmaster Blog, 1 February 2023, https://blogs.bing.com/webmaster/february-2023/The-Importance-of-Setting-the-lastmod-Tag-in-Your-Sitemap

  19. 19.

    Google, Sitemaps report, Search Console Help, https://support.google.com/webmasters/answer/7451001

  20. 20.
  21. 21.

    Gary Illyes, Spring cleaning: some sitemap extension tags are going away, Google Search Central Blog, 6 May 2022, https://developers.google.com/search/blog/2022/05/spring-cleaning-sitemap-extensions

  22. 22.

    Google Search Central, Tell Google about localized versions of your page, https://developers.google.com/search/docs/specialty/international/localized-versions

  23. 23.

    Fabrice Canel, Sitemaps: 4 basics to get you started, Bing Webmaster Blog, 18 May 2016, https://blogs.bing.com/webmaster/May-2016/Sitemaps-%E2%80%93-4-Basics-to-Get-You-Started

  24. 24.

    IndexNow, Frequently asked questions, https://www.indexnow.org/faq

Shelter

I’m running the London Marathon for Shelter. Sunday 25 April 2027

My personal fundraiser. Shelter, the National Campaign for Homeless People Limited, registered charity 263710 (England and Wales) and SC002327 (Scotland), registered with the Fundraising Regulator.