Crawling and Indexing

XML Sitemaps: What They Do and What to Include

What an XML sitemap lists, which URLs belong in it and which to leave out, and how to check the file for errors so it actually helps search engines.

On this page
  1. What a sitemap is
  2. What a sitemap does and does not do
  3. What to include
  4. What to leave out
  5. Size limits and structure
  6. About lastmod and the other fields
  7. How to tell search engines about it
  8. How to check it for errors
  9. Keeping it healthy

What a sitemap is

An XML sitemap is a file that lists addresses on your site you would like search engines to know about. It is written in a simple, machine-readable format, usually placed at an address like /sitemap.xml, and meant to be read by crawlers rather than people.

A small example looks like this:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.example.com/about/</loc>
    <lastmod>2026-10-15</lastmod>
  </url>
</urlset>

Each url entry contains a loc (the full address) and, optionally, a lastmod (the date it last changed in a meaningful way).

What a sitemap does and does not do

It does:

  • Help search engines discover pages, which is especially useful for new sites, large sites and pages with few internal links.
  • Give a hint about which address you consider the main version of a page.
  • Provide a modification date that can help crawlers decide what to revisit, if the dates are accurate.
  • Give you a reference list to compare against what is actually indexed.

It does not:

  • Guarantee that any page will be crawled or indexed. It is a suggestion.
  • Improve rankings on its own.
  • Replace good internal linking. A page that appears only in a sitemap and nowhere in your navigation is still an orphan page in practice.

Small sites with clear navigation can often be discovered without a sitemap. It is still cheap and sensible to have one.

What to include

The guiding rule: list pages you actually want indexed, in their final form. In practice, that means addresses which:

  • Return a normal success code.
  • Are the preferred version (the one your canonical tags point to).
  • Can be crawled and do not carry a noindex instruction.
  • Offer real content for visitors.

For most sites, that is the main pages, articles, category pages and product pages.

What to leave out

Including the wrong things sends confusing signals. Leave out:

  • Addresses that redirect. List the final destination instead.
  • Pages that return errors, including 404s and server errors.
  • Pages with a noindex tag. Listing a page while telling search engines not to index it is contradictory.
  • Non-preferred duplicates, such as parameter versions or the other protocol or host version.
  • Pages blocked in the robots file.
  • Internal search results, cart steps, account pages and thank-you pages.
  • Thin or placeholder pages you would not want people landing on.

If you notice your sitemap includes lots of these, it often means the sitemap is generated automatically from every page in the system, and the settings need adjusting.

Size limits and structure

A single sitemap file is generally limited to 50,000 addresses or 50 MB uncompressed. Larger sites split the list into several files and add a sitemap index file that points to each. Splitting by section (for example articles, products, categories) is a good idea even below those limits, since it lets you see problems per section in reports.

Other formats exist for images, video and news content, and are useful in particular situations, but most small sites do not need them.

About lastmod and the other fields

The lastmod date is only useful if it is truthful. If every page shows today’s date because the file regenerates daily, search engines learn to ignore it. Update it only when the content changes in a meaningful way, not when a footer changes.

Fields such as priority and change frequency are commonly said to be ignored by major search engines, so you generally do not need to spend time on them.

How to tell search engines about it

  • Add a Sitemap: line to your robots file with the full address of the sitemap.
  • Submit it in your search tools, which also gives you reports on how many addresses were read and whether any problems were found.

How to check it for errors

  1. Open the file in a browser to confirm it loads, is valid XML, and is not blocked or redirected.
  2. Use the reports in your search tools. They flag fetching problems, parsing errors and addresses that could not be read.
  3. Crawl the listed addresses. Feed the sitemap list to a crawler and check each status code. Anything that is not a success code should come out of the file or be fixed.
  4. Compare with the index. If many listed pages are not indexed, look at the reasons, covered in the article on indexing gaps. If indexed pages are missing from the sitemap, consider adding them.
  5. Check addresses are exact. The protocol, host name and trailing slash style should match your preferred version everywhere.
  6. Watch for special characters. Ampersands and similar characters need proper escaping in XML, or the file may not parse.

Keeping it healthy

If your platform generates the sitemap automatically, review its settings once, then check it again after major changes such as a redesign or a site migration. Treat the sitemap as a clean list of your best pages. The tidier it is, the more useful a comparison with your indexing reports becomes, and the easier your regular audits will be.

The complete guide to crawling and indexing

Crawling and Indexing Explained for Site Owners
Read the guide

Keep exploring

Guides from other topics

All topics →