An XML sitemap tells search engines about preferred URLs. Robots.txt tells compliant crawlers which paths they may fetch. They solve different problems: listing a URL does not make it indexable, and blocking a crawl does not reliably remove a webpage from search.
This guide brings the files together for someone maintaining a site. The separate sitemap introduction and robots.txt guide explain each file from the beginning.
Decide What Should Happen to Each URL
Consider an appliance shop with a public installation service, a generic booking-confirmation page, staff records and many low-value filter URLs. The following is an illustrative plan, not an audit of an actual store.
| URL purpose | Intended outcome | Appropriate action |
|---|---|---|
| Public cooker-hood installation page | Available to customers and eligible for search. | Link to it normally, allow crawling, use its preferred URL and include that URL in the sitemap. |
| Generic confirmation with no personal details | Usable by visitors but excluded from search. | Use crawlable noindex; leave it out of the sitemap. |
| Staff or customer records | Accessible only to authorised people. | Require authentication and server-side permission checks. |
| Low-value filters with a measured crawl problem | Reduce unnecessary crawler requests. | Consider a narrowly tested robots rule; decide indexing separately. |
A confirmation containing customer details belongs behind access control, not in the public-page row. Robots.txt is public and cannot enforce privacy. Google must be able to crawl a public page to read its noindex instruction; do not block that same page and expect the instruction to be seen.
Build a Clean Preferred-URL List
Check whether your CMS already generates the authoritative sitemap or sitemap index. Use the production protocol, host and complete paths. For the example, a minimal file could be:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/cooker-hood-installation/</loc>
</url>
</urlset>
This sample deliberately contains only the public service page. For an ordinary search sitemap, leave out redirects, errors, private pages, noindex pages and duplicate filter variants. Use the preferred canonical version, not every address that reaches the same content. Sitemap inclusion is one hint; it does not force Google's canonical choice.
Optional lastmod should describe the page's last significant update, not every site build. Google ignores priority and changefreq. A file must stay within both 50,000 URLs and 50 MB uncompressed; split larger sets into files and use an index if helpful.
For a small, manually prepared list, the XML Sitemap Generator can create a file from up to 5,000 URLs on one origin—the same protocol, host and port. It does not crawl the site or prove that the URLs are indexable. An automatically maintained CMS sitemap is usually easier to keep current than a second manual copy.
Write Only the Crawl Restrictions You Need
If the shop has confirmed excessive crawling of URLs under /internal-filter/, this sample asks compliant crawlers not to request that path:
User-agent: *
Disallow: /internal-filter/
Sitemap: https://example.com/sitemap.xml
Publish robots.txt at the exact host's root. Its scope is that protocol, host and port; a file on example.com does not automatically control shop.example.com. The Sitemap line points to the published URL list. It does not override a crawl restriction.
This is a conditional example, not a rule every site should adopt. An already indexed filter URL may remain in search after it is blocked. If removing it from the index is the goal, plan an accessible noindex response instead. Keep important pages and resources required to render them crawlable.
Before editing, inspect all user-agent groups. Google selects the most specific matching group rather than simply applying the final line or inheriting every wildcard rule. Test the full rule set with the crawler and URLs you intend to affect.
Test the Published Files and Representative Pages
- Open both exact file URLs. Confirm they return the intended text or XML, not a login, error document or staging copy. Open a child sitemap if the first file is an index.
- Check opposite cases. Test a URL meant to be blocked and an important service page that must stay allowed. Our Robots.txt Checker evaluates pasted rules; it does not fetch your deployed file or verify a real bot's access.
- Inspect the actual page. Check its response, robots meta or response header, canonical and internal links. Being listed and allowed is insufficient if the page redirects, errors or asks not to be indexed.
- Submit the sitemap URL in Search Console. “Success” confirms Google could read the file, not that every page entered the index.
- Investigate a missing URL. Read URL Inspection's indexed report and the stated exclusion reason. A live test can check current accessibility and possible indexability; it cannot guarantee a future index or canonical selection.
Record the rules changed, why, who approved them and which representative URLs were checked. After a migration or language rollout, repeat the checks for the affected hosts and real language URLs. Do not add language versions that redirect or do not exist.
Resolve the Conflict You Actually Find
- Listed in the sitemap but blocked: decide whether it should be a public search page. Correct the crawl rule or remove the inappropriate sitemap entry.
- Blocked and marked noindex: if index exclusion is intended for a public page, let Google fetch the response so it can see
noindex. - Sitemap uses an old or duplicate address: replace it with the intended final canonical URL and align internal links.
- Files look correct but the page is absent: inspect the page's actual indexing reason and content. Repeatedly submitting an unchanged file cannot resolve every indexing decision.
The crawling and indexing guide helps continue the diagnosis. File maintenance is complete when the controls express the site's real decisions, not when every URL is forced into the index.
Frequently Asked Questions
Does Every Site Need Both Files?
No special restrictions are necessary without a crawl problem. A small, well-linked site may not need a sitemap for Google to find its pages. Check the existing setup before adding duplicate files.
Does a Sitemap Override Disallow or noindex?
No. It helps discovery; it does not cancel crawl or indexing instructions. Resolve contradictory controls on the actual URL.
Will Removing a URL from the Sitemap Remove It from Google?
No. Google can know it through other sources. Choose a proper index-exclusion, removal or access-control method according to what the page should do.

