Practical guideUpdated

How to add your sitemap to robots.txt

Add a line to robots.txt that reads Sitemap: followed by the full absolute URL of your sitemap, for example Sitemap: https://www.example.com/sitemap.xml. The line can go anywhere in the file, is independent of user-agent groups, and can be repeated for several sitemaps. Search engines that read robots.txt, including Google and Bing, use it to discover your sitemap, alongside any submission in their webmaster tools.

Adding the sitemap to robots.txt takes one line and helps every search engine and crawler find it, including ones where you have no webmaster account. This page covers the syntax, the edge cases, and how it relates to submitting sitemaps directly.

By , Founder, SerionFlow

What we measured ·

What Google shows for "robots txt and sitemap xml" right now

Method: Live Google results (United States, desktop, English) for "robots txt and sitemap xml" retrieved through DataForSEO's SERP API on 2026-10-22. Page types are our own classification of each ranking URL.

The top 9 organic results for "robots txt and sitemap xml" were 3 forum or community threads, 3 guides or explainers, 1 official search-engine documentation, 1 product or service page, 1 list or comparison. The first three were www.reddit.com, developers.google.com, www.woorank.com. Community threads (www.reddit.com, stackoverflow.com, webmasters.stackexchange.com) ranked on page one, a sign searchers want first-hand answers, not only vendor pages.

Google showed an AI Overview for this query, citing 8 source domains including developers.google.com, www.woorank.com, webmasters.stackexchange.com, www.quora.com. Pages that state the answer directly and early are the ones an Overview can quote.

People Also Ask listed: "Is sitemap.xml still relevant?"; "Is robots.txt still relevant?"; "Is robots.txt legal?"; "What is sitemap.xml used for?". The sections below answer the ones within this page's scope.

Top organic results for "robots txt and sitemap xml", 2026-10-22
PositionDomainPage type
1www.reddit.comForum or community thread
2developers.google.comOfficial search-engine documentation
3www.woorank.comGuide or explainer
4stackoverflow.comForum or community thread
5developers.cloudflare.comProduct or service page
6www.broworks.netList or comparison
01

Syntax and placement

The Sitemap directive is defined in the sitemaps protocol and supported by the major search engines. It is not tied to a user-agent group, so it applies to every crawler wherever it appears. By convention it goes at the end of the file. The URL must be absolute, including protocol and host, and should be the canonical location that returns 200.

Sitemap lines in robots.txt
SituationLine or lines
Single sitemapSitemap: https://www.example.com/sitemap.xml
Sitemap indexSitemap: https://www.example.com/sitemap_index.xml
Several sitemapsOne Sitemap: line per file
Compressed sitemapSitemap: https://www.example.com/sitemap.xml.gz
Sitemap on another hostSitemap: https://cdn.example.com/sitemaps/site.xml (allowed)
02

Index or individual sitemaps?

If you use a sitemap index, list only the index; search engines follow it to the child sitemaps. Listing both the index and its children is harmless but unnecessary. serionflow.com lists a single sitemap index in robots.txt, which links child sitemaps for each page family.

03

Cross-host sitemaps

A robots.txt can reference a sitemap hosted on a different domain, such as a CDN or a dedicated sitemap host. The sitemaps protocol allows this when the robots.txt of the site whose URLs are listed points to it, which proves you control both. Google also accepts cross-site sitemap submission when you have verified both properties in Search Console.

04

Does it replace submitting in Search Console?

No; do both. robots.txt discovery helps every crawler, including those without webmaster tools. Submitting in Google Search Console and Bing Webmaster Tools gives you reporting on when the sitemap was read, how many URLs were discovered, and any errors, and lets you filter the Page indexing report by sitemap. For Bing and other engines that support IndexNow, you can also notify them of changed URLs directly.

05

Checking it works

Open /robots.txt and confirm the line uses the correct, live URL. Open that URL and confirm it returns XML with a 200 status. If you changed sitemap location, update robots.txt in the same deploy. On WordPress, SEO plugins usually manage the line automatically. Our robots.txt checker and sitemap checker read the live files and flag a missing or broken Sitemap line. SerionFlow is the wrong tool for editing your robots.txt; add the Sitemap line where your file is generated.

Clear answers

Frequently asked questions

Why do people include a sitemap in robots.txt?

+

So that any crawler reading robots.txt can discover the sitemap, without the site owner submitting it to each search engine.

Is sitemap.xml still relevant?

+

Yes. Sitemaps help search engines discover and prioritise URLs, especially on new, large, or weakly linked sites.

About the author

· Founder, SerionFlow

Shadrack builds SerionFlow's site research, page generation, and Search Console tooling, and runs the free tools these guides pair with. Search Console figures cited on these pages come from serionflow.com's own property.

Continue exploring

Related SerionFlow resources

More in Guides

All guides

Make the next move obvious

Let SerionFlow turn your market evidence into momentum.

Confirm the market, rank the opportunities that matter, create brand matched pages on your domain, and keep moving with controlled weekly intelligence.

Choose how SerionFlow uses cookies.

Essential cookies keep the site secure and working. Product analytics helps us improve reliability. Optional cookies help us remember preferences and improve campaigns. You can change optional cookies anytime in Cookie Settings.