You built a sitemap: a clean list of every URL on your site that you want crawled. Then you put it on the server and waited. A sitemap only helps if crawlers find it, and there is a simple announcement that sits in a file crawlers already read first: a Sitemap line inside robots.txt.

This guide explains what that line does, where it belongs in the file, and how to add it with the free Robots.txt Generator on Ovatly, which builds a valid robots.txt from visual rule groups and your sitemap addresses. It also covers the mistakes that make the line useless, most of which come down to one word: the address has to be complete.

Contents

  • Quick answer
  • What the Sitemap line is
  • Where the line sits: outside the rule groups
  • Why the address must be absolute
  • One line per sitemap
  • How to add the line, step by step
  • Worked example: the generator's own output
  • Limitations and honest expectations
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

Add a line reading Sitemap: followed by the full, absolute address of your sitemap, for example Sitemap: https://example.com/sitemap.xml. The line sits outside the rule groups, at the end of the file, and it applies to every crawler rather than to one named group. If you have several sitemaps, give each one its own line. In the Robots.txt Generator you do not type the line by hand: you add your sitemap address in the tool, alongside your rule groups, and the generated file carries the line in the right place.

What the Sitemap line is

Most of a robots.txt file is rules: groups that name crawlers and list the paths they may not fetch. The Sitemap line is different in kind. It is not a rule and it grants or denies nothing. It is a pointer that says: here is the address of this site's sitemap, the file that lists the URLs the site wants crawled.

That difference matters for how you think about it. A Disallow line speaks to the crawlers in its group and restricts them. A Sitemap line speaks to any crawler reading the file and informs it. Crawlers read robots.txt before they crawl a host, so the pointer reaches them before they have fetched a single page.

Where the line sits: outside the rule groups

Because the Sitemap line belongs to no group, it is written outside them. The generator's own example output shows the placement plainly: the rule group comes first, then a blank line, then the Sitemap line on its own:

User-agent: *
Disallow: /admin/
Disallow: /tmp/

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

The blank line is the tell. Everything above it is one group's business: the crawlers it names and the paths it closes. The Sitemap line below it is the file's business, addressed to every reader. Placing it inside a group, as if it were one crawler's private instruction, misunderstands what it is. It names no crawler because it is for all of them.

Why the address must be absolute

The address in a Sitemap line must be a complete URL: protocol, host and path, exactly as https://example.com/sitemap.xml is complete. A relative reference such as /sitemap.xml leaves the crawler to guess the host and scheme, and a pointer that needs guessing is a pointer that fails quietly.

This is stricter than how paths work elsewhere in the file. Disallow and Allow lines take paths, because they operate inside a host the crawler is already visiting. The Sitemap line sends the crawler to fetch a file, so it carries the whole address with it. When you add the address in the generator, paste the full URL you would type into a browser to open the sitemap itself, and check that it opens.

One line per sitemap

Sites with more than one sitemap list each one on its own line. The generator's design reflects this: it takes "your sitemap addresses", plural, as an input separate from the rule groups, and the finished file writes one Sitemap: line per address. Two sitemaps, two lines, both outside the groups:

Sitemap: https://example.com/sitemap.xml
Sitemap: https://example.com/sitemap-images.xml

There is no combining syntax and no comma-separated list. Each line is a complete, standalone pointer, so a crawler can act on any one of them without parsing the others.

How to add the line, step by step

  1. Open the Robots.txt Generator. In the first group, list the user agents the rules apply to (use * for all crawlers).
  2. Add Disallow paths to block and Allow paths to reopen parts of a blocked section, one per line.
  3. Add another group if one crawler needs different rules.
  4. Add your sitemap URL, the full absolute address, and add a further address for each additional sitemap you want listed.
  5. Copy or download the generated robots.txt and place it at the root of your domain, where it is reachable as https://example.com/robots.txt for your own host.

Then verify twice over: open the sitemap address itself in a browser to confirm it loads, and run the finished robots.txt through the Robots.txt Tester on this site with a few real paths.

Worked example: the generator's own output

The tool's documentation gives an exact example, and it shows every point in this guide at once. One group with user agent *, Disallow paths /admin/ and /tmp/, and the sitemap https://example.com/sitemap.xml produces exactly:

User-agent: *
Disallow: /admin/
Disallow: /tmp/

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

The group does the restricting: every crawler is kept out of the admin area and the temporary folder. The Sitemap line does the pointing: separated from the group by a blank line, addressed to no crawler in particular and therefore to all of them, carrying a full absolute address. Nothing in the line restricts anything, and nothing in the group points anywhere.

Limitations and honest expectations

The Sitemap line is a discovery aid, nothing more. It tells crawlers where the sitemap is; it does not make the sitemap's contents correct, and it does not control indexing. robots.txt as a whole controls crawling, not indexing or security, so listing a URL here or in the sitemap is not a promise about search results, and a disallowed page can still appear in results if other sites link to it.

Two structural limits apply. The robots.txt file must live at the root of the host, and each subdomain needs its own file, which means the sitemap reference for a subdomain's content belongs in that subdomain's own robots.txt. And the file is public: anyone can read it, including your Sitemap line. That is normal and harmless for a sitemap, but it is the same reason you should never list secret paths anywhere in the file.

Common mistakes

  • Writing a relative address. Sitemap: /sitemap.xml omits the protocol and host. The line needs the full URL.
  • Tucking the line inside a group. Placed under one user agent, it reads as that crawler's rule. It belongs outside the groups, where the generated file puts it.
  • Cramming several sitemaps onto one line. Each address gets its own Sitemap: line.
  • Referencing the wrong host's sitemap. The pointer should name the sitemap for the host whose robots.txt file this is; subdomains have their own files and need their own lines.
  • Expecting the line to block or rank something. It points. Disallow lines block crawling; nothing in robots.txt controls indexing.

FAQs

What does the Sitemap line in robots.txt do? It tells crawlers where your sitemap file lives, by its full address, so they can find the list of URLs you want crawled without first discovering it through links.

Where does the Sitemap line go in the file? Outside the rule groups. In the file the generator produces, the Sitemap line appears after the groups, separated by a blank line, because it is not part of any one group's rules.

Can I list more than one sitemap? Yes. The generator takes your sitemap addresses, plural, and each one is written on its own Sitemap line in the finished file.

Does the Sitemap line block or allow any crawling? No. It is a pointer, not a rule. Blocking and allowing are done by the Disallow and Allow lines inside rule groups; the Sitemap line only says where the sitemap is.

How do I test the finished file? Use the Robots.txt Tester on this site with the generated content and a few real paths from your site, especially anything you meant to keep crawlable.

Conclusion

The Sitemap line is the simplest thing in robots.txt: one line, a full address, placed outside the rules it has nothing to do with. Get the address absolute, give every sitemap its own line, and let the line do its one job. The Robots.txt Generator collects the addresses while you build your groups and writes the lines into the finished file in the right place. The neighbouring guides in the SEO Tools category cover the rest of the file.

Related guide: What Is a Crawl Delay and Should You Use One?.

References