How to Give Your Sitemap to Search Engines
There are two common ways to tell a search engine where your sitemap is. You can add one line to your robots.txt file. Or you can paste the address into the search engine's own tools. Either works, and you can use both.1
First, put the sitemap online
Upload the file to your site and open its address in a browser. If you can see it, the file is online. To confirm Google can fetch it, run a live URL inspection in Search Console. The sitemap must be reachable by Googlebot, with no login in the way and no robots.txt rule blocking it.2
Google recommends the site root. A sitemap posted there can affect all files on the site.1
Write down the full address, starting with https://.
Way one: a line in robots.txt
Google says to insert a line anywhere in your robots.txt file, giving the path to your sitemap. It will find it the next time it crawls the robots.txt file.1
The line looks like this:
Sitemap: https://www.example.com/sitemap.xml
Use the full address, not a short path. The sitemaps.org protocol describes this same line as a way to give the location.3 More than one sitemap? Add one line each. Google says you can specify multiple sitemap lines.1 The protocol also allows more than one Sitemap file per robots.txt file.3
If you don't have a robots.txt file yet, the guide to making one shows how.
Way two: Google Search Console
Search Console is Google's tool for site owners. Its Sitemaps report lets you submit the address directly.1
The steps, in short:
- Make sure the sitemap is on your site and open to the public.
- Open the Sitemaps report.
- Paste the address into the "Add a new sitemap" box and click Submit.2
- Look at the status afterwards. The report shows only sitemaps submitted through it or the API. A sitemap found only through a robots.txt line will not appear in it.2
You need owner permissions on the property to do this. If you don't have them, Google says you can list the sitemap in your robots.txt file instead.2
Why bother when robots.txt works? The report lets you see when Googlebot accessed the sitemap and any processing errors.1
Don't block the sitemap itself
A robots.txt rule can stop Google reading your sitemap. Google respects robots.txt when fetching sitemaps, so you must remove any rule that blocks it.2
What submitting does and doesn't do
Submitting is only a hint. Google says it doesn't guarantee that it will download the sitemap or use it for crawling URLs on the site.1
So don't expect pages to appear in search the same day.
What about Bing?
Bing has its own webmaster tools and help pages. Use those for its exact steps, because every search engine can differ. The sitemaps.org protocol, which is written for search engines in general, also describes the robots.txt line as a way to give a sitemap's location.3
For a check on what your file says before you submit it, see the line-by-line guide.
Cited material
- Build and Submit a Sitemap, Google Search Central
- Sitemaps report, Google Search Console Help
- sitemaps.org Protocol, sitemaps.org