What is an XML sitemap, and how do you set it up right?

A sitemap is the list of pages you hand to Google so it does not have to guess. It takes an hour to set up well and years to notice when it is set up badly. Here is how to get it right, from someone who manages sitemaps for stores with millions of products.

Key takeaways

  • A sitemap is a file that lists the pages you want Google to find. It is a hint, not an order.
  • One sitemap file holds up to 50,000 URLs or 50 MB. Bigger sites split it and use a sitemap index.
  • Only include pages that return 200, are canonical and that you want indexed.
  • Submit it in Search Console and add it to robots.txt, then watch the indexing report.
50,000URLs per sitemap file, or 50 MB uncompressed (Google)
3M+products across the 18 US online stores I supervise
60+sitemap files needed just to list 3 million URLs

What is an XML sitemap?

An XML sitemap is a file on your website that lists the URLs you want search engines to find, often with the date each page last changed. Google uses it to discover pages it might miss through links alone. It does not guarantee crawling or indexing, but it makes your important pages much easier to find.

Google finds most pages by following links from pages it already knows. Its guide to how Search works describes a second route: pages are also discovered when you submit a list of them, a sitemap. Google's sitemap overview says sitemaps help most on large sites, new sites with few links and sites with pages that are poorly linked inside.

That describes almost every online store I have worked on. A product that sits on page 40 of a category, or that only appears after three filters, may never be reached by a crawler. The sitemap is how you tell Google that page exists. If you want the wider picture first, read what technical SEO is.

What should a sitemap include, and what should it leave out?

Include only the final, canonical version of pages you want in Google: they should load with a 200 status and not be blocked or marked noindex. Leave out redirects, error pages, filtered or sorted URLs, internal search results, carts and duplicates. A short, clean sitemap is worth more than a long one full of noise.

IncludeLeave out
Home, service, category and product pagesURLs that redirect (301 or 302)
Blog posts and guidesPages that return 404 or 410
Location pages with real, unique contentFilter, sort and tracking-parameter URLs
The canonical version of each pagePages with noindex or a canonical pointing elsewhere

The rule behind the table is simple: the sitemap should agree with the rest of your signals. If a page says its canonical URL is somewhere else, listing it in the sitemap sends Google two opposite messages. In audits, I often find sitemaps generated by a plugin years ago that still list thousands of discontinued products. Google keeps checking those URLs and finds errors, which wastes the attention it could spend on your live pages.

How big can a sitemap be?

Google's limit is 50,000 URLs or 50 MB uncompressed per sitemap file, whichever comes first. If your site is bigger, you split the URLs into several files and list those files in a sitemap index, which is the only file you need to submit. Most stores split by type, for example products, categories and blog.

This is spelled out in Google's guide to building and submitting a sitemap. For the 18 US stores I supervise, with more than 3 million products in total, that limit means a store-wide product list needs over 60 sitemap files, all tied together by an index. We also split them by type so that when the indexing report shows a problem, we can see straight away whether it affects products, categories or content.

Split by type

One sitemap for products, one for categories, one for posts. Problems become easy to locate.

Honest lastmod

Google uses the last modified date only when it is consistently accurate. Do not stamp every URL with today's date.

Skip priority

Google ignores the priority and changefreq tags, so there is no need to tune them.

Generate it automatically

The sitemap should update itself when you add or remove a page, not when someone remembers.

Check it monthly

Compare submitted URLs with indexed URLs in Search Console.

Remove sold-out pages

Products that are gone for good should leave the sitemap the same day they leave the store.

How do I submit a sitemap to Google?

Open Google Search Console, go to the Sitemaps report, paste the sitemap URL, usually yoursite.com/sitemap.xml, and press Submit. Also add a line to your robots.txt file that says Sitemap: followed by the full URL, so other search engines find it too. Then check the report after a few days for errors.

  1. Find your sitemap. WordPress with an SEO plugin and Shopify create one automatically. Shopify explains where to find it in its help center.
  2. Open it in a browser. Make sure it loads and lists the pages you expect, not test pages or old products.
  3. Submit it in Search Console. Use the Sitemaps report. You only need to submit the index if you have several files.
  4. Add it to robots.txt. One line: Sitemap: https://www.yoursite.com/sitemap.xml.
  5. Read the results. In the Pages report, filter by sitemap and look at the reasons pages are not indexed.

How to read what Google does with your sitemap

Submitting is the easy part. The value is in comparing what you sent with what Google kept. If you submit 10,000 product URLs and only 4,000 are indexed, the sitemap has done its job of showing you a problem. The usual causes are thin or duplicate product pages, weak internal links to deep categories, or URLs that should never have been in the file. Fixing those is the core of e-commerce SEO and of a good technical SEO plan.

  • "Discovered, currently not indexed" on many products usually points to weak internal links or thin content.
  • "Duplicate without user-selected canonical" means variants or filters are competing with the main page.
  • "Not found (404)" inside the sitemap means the file is out of date.
  • A sitemap that lists far more URLs than you have products deserves a full technical checklist.

Do I need help with my sitemap?

A small site on WordPress or Shopify usually only needs to submit the automatic sitemap and check it once a month. You need help when the site has thousands of products or locations, when many submitted pages are not indexed, or after a redesign or platform change, when old and new URLs often get mixed up.

A sitemap review is part of every SEO audit I do. For large catalogs, read SEO for large e-commerce catalogs, or book the free 30-minute diagnosis from the home page and we will look at your Search Console together.

Frequently asked questions

Does a sitemap improve rankings?

Not directly. It helps Google find and recrawl your pages. Rankings still depend on content, links and page quality.

Is an HTML sitemap the same as an XML sitemap?

No. An HTML sitemap is a page for people. The XML sitemap is a file written for search engines. Many sites have both.

How often should the sitemap update?

Every time you add, change or remove an important page. Good platforms and plugins do this automatically.

Should images be in the sitemap?

Image sitemaps can help Google find images it would not discover otherwise, such as images loaded by scripts or hosted on a CDN.

I submitted my sitemap and nothing happened. Why?

A sitemap is a hint, not an order. If pages are not indexed, the reason is usually quality, duplication or internal links, not the sitemap itself.

Juan José Giraldo, SEO consultant

About the author

Juan José Giraldo is an SEO consultant in Medellín, Colombia, with 5+ years of experience. He works on technical and local SEO for 600+ US car dealerships at Reunion Marketing, an Inc. 5000 agency, and supervises the SEO of 18 US online stores with more than 3 million products at Prontomowers. Read more · LinkedIn.

Sources

  1. Google Search Central, Build and submit a sitemap
  2. Google Search Central, What is a sitemap
  3. Google Search Central, In-depth guide to how Google Search works
  4. Shopify Help Center, Finding and submitting your sitemap
  5. Google Search Central, How to specify a canonical URL

Find out what is holding your traffic back.

Get a free SEO audit and a 30-minute call. You leave with the three changes I would make first, whether you hire me or not.