The TORO RANK mascot holding a sitemap.xml site tree next to a robots.txt screen with Allow and Disallow rules

What Is an XML Sitemap? Sitemap.xml and robots.txt Explained

An XML sitemap is a file that lists the URLs on your site that you want search engines to find and index. Google describes it as a file where you give information about the pages, videos and other files on your site. A sitemap helps discovery, but it does not guarantee that a page will be crawled or indexed. Google calls submitting one “merely a hint”.

robots.txt does a different job. It tells crawlers which paths they may crawl, and it can point them to your sitemap with one line. This guide explains both files, what belongs in a sitemap, Google’s limits, how the two work together, and how to check them in Search Console. The facts come from Google’s, Bing’s and WordPress’s own documentation, checked on November 30, 2026.

What is an XML sitemap?

An XML sitemap is a list of URLs written in a standard format from sitemaps.org. Each URL sits in its own <url> entry, and the only required tag inside it is <loc>, the full address of the page. A small sitemap looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.example.com/</loc>
    <lastmod>2026-11-27</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/services/seo-audit/</loc>
    <lastmod>2026-11-12</lastmod>
  </url>
</urlset>

The optional tags do not all count:

  • <lastmod> is the date the page last changed. Google says it uses this value only if it is consistently and verifiably accurate. Bing says the same in its own words: if your dates are always the current date, it may disregard them. Set it to the date the content really changed, not the date the sitemap was generated.
  • <changefreq> and <priority> are ignored by Google, and Bing says it largely disregards them. You can leave them out.

The file must be UTF-8 encoded and use full, absolute URLs, including https://.

Do you need a sitemap?

Google says a sitemap helps most in these cases:

  • the site is large, so new pages are easy to miss;
  • the site is new and has few links from other sites;
  • the site has a lot of video or images, or appears in Google News.

Google also says you may not need one if your site has about 500 pages or fewer and every page is linked from other pages on the site.

In practice, we add one anyway. On WordPress it costs nothing, it gives Search Console a list to report against, and it shows you quickly when a page you care about is missing or broken.

Which URLs belong in the sitemap?

Only the URLs you want to see in search results. A sitemap full of redirects and duplicates makes its reports in Search Console hard to read.

What to put in a sitemap and what to leave out
Put inLeave out
Pages that return 200URLs that redirect (301, 302)
The canonical version of each pageDuplicates that point to another canonical
Pages you allow in the indexPages with noindex
One address per pageParameter, sort and filter variants of the same page
Live pagesPages that return 404 or 410
Pages robots.txt lets crawlers reachPaths blocked in robots.txt

Leaving a URL out does not hide it. Google says it can still crawl and index a page that is missing from your sitemap if other pages link to it. To keep a page out of search, use noindex, as explained below.

What are Google’s sitemap limits?

Sitemap limits, as Google and sitemaps.org document them (checked November 30, 2026)
ItemLimit
URLs in one sitemap50,000
Size of one sitemap50 MB uncompressed (you can gzip it, but the limit applies to the uncompressed file)
Sitemaps listed in one sitemap index50,000
Sitemap index files per site in Search Console500
Sitemap index inside another indexNot supported
Length of one URL in <loc>Under 2,048 characters
EncodingUTF-8

A site larger than one sitemap splits its URLs into several files and lists them in a sitemap index. Google says the files an index lists must be on the same site, in the same directory as the index or lower, unless you have set up cross-site submission.

WordPress and its SEO plugins split sitemaps on their own. WordPress’s core sitemap holds up to 2,000 entries per file by default, according to the WordPress 5.5 announcement.

What does robots.txt do, and how does it work with the sitemap?

robots.txt is a plain text file at the root of your host, for example https://www.example.com/robots.txt. Google says it must sit at the root, cannot sit in a subdirectory, and must be UTF-8 encoded. It tells crawlers that follow it which paths they may crawl.

It can also announce your sitemap with a Sitemap: line. Google says the line is optional, you can list more than one, and the URL must be fully qualified. Google does not try the http, https, www or non-www variants for you, so write the exact address.

This is the robots.txt of tororank.com, made by the Yoast SEO plugin:

User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

Disallow: /?s=
Disallow: /feed/
Disallow: /cdn-cgi/

Allow: /wp-content/uploads/
Allow: /wp-content/plugins/
Allow: /wp-content/themes/

Sitemap: https://tororank.com/sitemap_index.xml

It keeps crawlers out of the admin area, internal search results, feeds and Cloudflare’s own paths, leaves the files that render the pages open, and points to the sitemap index.

A few robots.txt rules from Google’s documentation cause most mistakes:

  • A crawler obeys one group only, the one with the most specific user agent that matches it. A group for one named bot does not inherit the * rules.
  • Google reads only the first 500 KiB of the file and usually caches it for up to 24 hours.
  • If robots.txt returns a server error (5xx), Google stops crawling the site for the first 12 hours.

Our guide to blocking AI bots without hurting SEO covers these rules in detail, with examples.

Disallow, noindex or canonical: which one do you need?

These controls look alike but do different jobs, and you cannot swap one for another.

Which control to use for which goal
GoalUseWhy
Stop crawling of a path, such as admin or internal searchDisallow in robots.txtIt controls crawling. A blocked URL can still be indexed from links elsewhere
Keep a page out of Google’s indexnoindex meta tag or HTTP headerGoogle must crawl the page to read it, so do not also block it in robots.txt
Show one version of near-duplicate pagesrel="canonical"It points Google to the preferred URL. It is a strong hint, not a rule
Move a page for good301 redirectIt sends visitors and Google to the new address
Help Google find important pagesXML sitemapIt is a list of URLs you want found, and a hint

The most common mix-up is a page that is blocked in robots.txt and also has noindex. Google never sees the noindex, because it is not allowed to crawl the page. Google explains each control in its guide to controlling what you share with Google.

How do you set up a sitemap in WordPress?

Since version 5.5, WordPress makes a sitemap by itself at /wp-sitemap.xml. SEO plugins such as Yoast SEO can replace it with their own. On tororank.com, Yoast SEO serves the sitemap index at /sitemap_index.xml, and /wp-sitemap.xml redirects there with a 301.

The tororank.com index lists four sitemaps: posts, pages, categories and the author page. On November 30, 2026 the post sitemap held 205 URLs and the page sitemap 67. Yoast’s help page says content types marked noindex are left out of the sitemap automatically, which is what you want.

Check three things after you set it up:

  1. Open the sitemap URL in a browser and confirm it returns 200 and lists the pages you expect.
  2. Make sure your robots.txt has the Sitemap: line with the exact address.
  3. Open a few URLs from the sitemap and check that each one returns 200, has no noindex and points its canonical to itself.

How do you check the sitemap in Search Console?

In Google Search Console, open the Sitemaps report and submit the sitemap or the sitemap index URL. The report shows whether Google could read it, when it last read it, and how many URLs it found.

Then use the Page indexing report. Its filter at the top lets you switch from “All known pages” to “All submitted pages”, which shows only the URLs from your sitemaps and why some of them are not indexed. For a single page, URL Inspection shows whether it is indexed, when Google last crawled it, and which canonical Google chose.

Submit the sitemap in Bing Webmaster Tools too. Bing Webmaster Tools also reports citations in Microsoft Copilot, and Bing gives the same advice as Google on accurate lastmod dates.

What should you check after a migration or redesign?

A move is when sitemap and robots.txt mistakes do the most harm. Check these before and right after launch:

  1. robots.txt on the new site does not block the whole site. A staging rule such as Disallow: / left in place stops every crawler that follows robots.txt.
  2. The sitemap lists the new URLs, not the old ones that now redirect.
  3. Every old URL redirects with a 301 to the closest new page.
  4. Canonical tags point to the new addresses.
  5. The new sitemap is submitted in Search Console, and the Page indexing report is watched for the next weeks.

Our robots.txt validator shows which bots and paths a robots.txt file blocks, so you can check the new file before you go live.

Frequently asked questions

Does a sitemap guarantee indexing?

No. Google says a sitemap does not guarantee that the items in it will be crawled and indexed. It is a hint that helps Google find the pages.

Should every page be in the sitemap?

No. List only pages that return 200, are canonical and are allowed in the index. Leave out redirects, duplicates, noindex pages and URLs blocked in robots.txt.

Can I have more than one sitemap?

Yes. You can list several sitemaps in a sitemap index and submit the index. Each sitemap can hold up to 50,000 URLs or 50 MB uncompressed.

Do priority and changefreq matter?

Not for Google, which says it ignores both. Bing says it largely disregards them. An accurate lastmod date is worth more.

When should you ask for help?

A small site with a standard WordPress setup rarely needs more than the checks above. If Search Console shows many submitted pages that are not indexed, or traffic dropped after a migration, a technical SEO and GEO audit finds the cause page by page. For a quick first look at how ready your site is for AI search, run the free GEO check.

Related articles