It’s a best practice to always reference your XML sitemap(s) in your robots.txt file.
Here are the rules of engagement:
- Reference the absolute URL to your XML sitemap
- You can reference multiple XML sitemaps
- You can rerence regular XML sitemaps, and XML sitempap indices
- You can reference XML sitemaps on another domain, meaning: if your domain is example.com and your XML sitemap is on example2.com then you can reference that domain.
On top of this, we always recommend also submitted your XML sitemaps through Google Search Console and Bing Webmaster Tools.
XML sitemap correctly referenced
In this example, XML sitemaps are correctly referenced:
XML sitemap incorrectly referenced
In this example, the XML sitemap is — incorrectly — referenced using a relative URL:
XML sitemap correctly referenced, but disallowed
In this example, the XML sitemap is correctly referenced but search engines won’t be able to access it because of the
Disallow: / directive: