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
Barrow Outdoor (an invented example) is an online shop for garden and outdoor furniture in Kilkenny, run by Aoife, at barrowoutdoor.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.
Aoife's robots.txt and sitemap were generated by her 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.txton the host it governs1. Google adds that the rules apply only to the exact host, protocol and port where the file sits, soshop.example.comneeds 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 Aoife's file is for, and what it is not for
Aoife has two kinds of URL she would rather search engines left alone. The first is her 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 her trade price list, a PDF for landscapers that she 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/paymentbut not/Checkout/payment, and not/checkoutwithout 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/andAllow: /garden/benches/both match a URL, the longer, more specific rule decides, so/garden/benches/teakmay 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: Googlebotgroup, Googlebot does not read theUser-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 Aoife's file as Googlebot would
This is the robots.txt Aoife's old platform produced:
# barrowoutdoor.example, BEFORE
User-agent: *
Disallow: /assets/
Disallow: /checkout/
Noindex: /search/
Crawl-delay: 10
User-agent: Googlebot
Disallow: /account/
Sitemap: http://barrowoutdoor.example/sitemap.xml
Read it as Googlebot, line by line.
- Googlebot looks for the most specific group. There is a
User-agent: Googlebotgroup, so it uses that one and ignores the*group completely. - For Googlebot, therefore, only
/account/is blocked. The checkout is not blocked for Google at all, even though Aoife believes it is. - The
Noindex: /search/line does nothing. Google stopped supportingnoindexinside robots.txt on 1 September 20194, and it was never part of the standard. Crawl-delay: 10does nothing for Google, which ignores the field2.- The
Sitemapline 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 Aoife'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.
Example: a Friday release at Barrow Outdoor
Picture a release that goes wrong. On a Friday afternoon, a new theme goes live on Aoife'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.
- 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.
- Aoife adds 40 new lounge sets for the summer on Monday. None of them is crawled, so none of them can be indexed.
- Existing product pages stay in the index for now, but Google cannot refresh them. Prices and stock in the results drift away from reality.
- As Google reprocesses pages, some appear in Search Console as "Indexed, though blocked by robots.txt", with almost no snippet. Others drop out.
- 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: Aoife's internal search pages
Aoife'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 her 4,100 indexed pages are search results. They are thin, they compete with her real category pages, and she wants them gone.
Her 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.
- Google fetches the new robots.txt and stops requesting any URL under
/search. - Because it no longer requests those pages, it never sees the new noindex tag.
- 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:
- Add the noindex tag to the search results template. Leave robots.txt alone, so Google can still crawl those pages.
- 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.
- Once they have dropped out, add
Disallow: /searchif 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):
| Rule | What it does | When to use it |
|---|---|---|
noindex | Keeps the page out of search results | Thank you pages, internal search results, thin duplicates you cannot remove |
nofollow | Asks Google not to follow the links on the page | Rarely: pages full of links you do not vouch for |
none | Same as noindex and nofollow together | Rarely |
nosnippet | No text snippet or video preview. Google also documents it as keeping the page from being used directly in AI Overviews and AI Mode | Pages 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 limit | Fine control over quoting |
max-image-preview:[setting] | Sets the image preview size: none, standard or large | Product images you want shown large in results |
noimageindex | Keeps the images on the page out of image results | Rarely |
unavailable_after:[date] | Drops the page from results after the given date | Event pages, time limited offers |
noarchive | No longer used by Google Search, since Google's cached page link is gone | Leave it out of new templates |
A few behaviours are worth knowing9:
- When rules conflict, the more restrictive one applies.
nosnippetbeatsmax-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-Tagare 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 Aoife's thank you page and her PDFs
Aoife has three noindex jobs.
- The newsletter confirmation page (
/newsletter/thanks). Nobody should land on it from Google. Aoife adds<meta name="robots" content="noindex">to the template and leaves the page crawlable, so Google can see the tag. (Her 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.) - The assembly instructions. Her 1,850 products come with about 900 PDF assembly guides (a derived figure for this example). She wants those found, because people search for "how to assemble" a specific bench, so they get no noindex at all.
- 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, Aoife 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.
Example: Aoife's four kinds of unwanted URL, sorted
Aoife lists every kind of URL she does not want in search and runs each through the flow.
| URL type | Private? | Duplicate? | Already indexed? | Crawl waste? | Decision |
|---|---|---|---|---|---|
| Trade price list PDF | Yes | No | No | No | Login, then nothing else needed |
| Basket, checkout, account | No | No | No | Yes | Disallow in robots.txt |
| Internal search results | No | No | Yes, 1,400 | Yes | noindex first, Disallow once they drop out |
| Filter and sort combinations | No | Yes, of the category | A few | Yes, most of the 210,000 | Disallow 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.
Aoife'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.
# barrowoutdoor.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://barrowoutdoor.example/sitemap_index.xml
Prefix matching cuts both ways, so Aoife 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, Aoife 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. Aoife 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
locholds 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&. changefreqandpriorityare 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 Aoife's old sitemap
Aoife'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 URL | Count | Belongs in the sitemap? |
|---|---|---|
| Live product pages, canonical, status 200 | 1,850 | Yes |
| The same products again under category paths, canonical pointing elsewhere | 1,850 | No, duplicates |
| Discontinued products, now 404 or redirected | 1,320 | No, not status 200 |
| Filter and sort URLs with parameters | 5,642 | No, about to be blocked |
| Categories, subcategories and curated filter pages | 540 | Yes |
| Service and information pages | 26 | Yes |
| Login, basket and account pages, all noindexed | 12 | No, noindexed |
| Buying guides | 0 | Missing: the blog runs on a separate system |
| Total | 11,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).
where is the sitemap's precision, its coverage, the number of listed URLs that pass all five tests above, the total number of URLs in the sitemap, and 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):
where is the useful share of the crawl, the number of useful URLs on the site, and the number of distinct URLs Googlebot requested in the month.
Example: Aoife's numbers, worked through
Precision before the clean up: 2,416 good URLs out of 11,240 listed.
So 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).
So is 93.1%: the coverage looks grand, 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.
So 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 Aoife does not want indexed, and almost all of the crawling goes to filter combinations. The sitemap fix raises and to 100%, because the sitemap is fully under Aoife's control. The robots.txt fix is what moves , and how far it moves depends on how Google recrawls the site over the following months, so Aoife measures it rather than predicting it.
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 Aoife's dates come from
Aoife'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.
- 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.
- Category pages: the date the category's own copy or its list of products last changed. If that is hard to track reliably, Aoife leaves
lastmodout for categories, as Google allows17. - Guides: the date an editor last changed the article's text, taken from the blog system.
- 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: Aoife's sitemaps after the clean up
Aoife now has one index and four sitemaps:
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://barrowoutdoor.example/sitemap_index.xml -->
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://barrowoutdoor.example/sitemaps/products.xml</loc>
<lastmod>2025-06-09</lastmod>
</sitemap>
<sitemap>
<loc>https://barrowoutdoor.example/sitemaps/categories.xml</loc>
<lastmod>2025-06-02</lastmod>
</sitemap>
<sitemap>
<loc>https://barrowoutdoor.example/sitemaps/guides.xml</loc>
<lastmod>2025-06-06</lastmod>
</sitemap>
<sitemap>
<loc>https://barrowoutdoor.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://barrowoutdoor.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.barrowoutdoor.example/p/teak-bench-150-front.jpg</image:loc>
</image:image>
<image:image>
<image:loc>https://cdn.barrowoutdoor.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.
- 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. - 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.
- 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.
- 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: Aoife's submission checklist
- Update the
Sitemap:line in robots.txt tohttps://barrowoutdoor.example/sitemap_index.xml. - In Search Console, remove the old
sitemap.xmlfrom the Sitemaps report, then make the old URL return a 404 so it cannot be read either. Submit the new index. - Check that all four child sitemaps show Success, and that the discovered URL counts add up to 2,596.
- In Bing Webmaster Tools, submit the same index.
- Set the shop to send IndexNow notices when a product is added, changed or discontinued.
- 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 check | Where | What good looks like |
|---|---|---|
| robots.txt fetched and parsed | Search Console robots.txt report | Fetched, no errors, the new version shown |
| Sitemaps read | Search Console Sitemaps report | Success on all four files |
| Indexing of submitted URLs | Page indexing report, filtered to all submitted pages | Indexed share of the 2,596 rising over the weeks |
| Search pages leaving the index | Page indexing report, noindex status | Count rising towards 1,400, then stable |
| Crawl spread | Server logs, or the Crawl stats report | A falling share of requests on parameter URLs |
| Rendering | URL Inspection, live test | Styled 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 Aoife's report honestly
Six weeks after the change, Aoife filters the page indexing report to her products sitemap. She does not compare the total indexed count with the old 4,100, because that old number included 1,400 search pages she deliberately removed. She compares like with like: of the 1,850 products she 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 Aoife, 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.
