🔥 Black Friday is LIVE — 15% off every in-person pass with code BLKFRI2027. Ends Dec 3🔥 15% off all passes · code BLKFRI2027Shop the sale →
Technical SEO

XML Sitemap Guide

An XML sitemap is the list of URLs you want search engines to know about — a map you hand Google so it doesn't have to discover every page by crawling links

Terry Samuels Terry Samuels
Founder, SEO Spring Training
·Oct 11, 2026 ·7 min read

An XML sitemap is the list of URLs you want search engines to know about — a map you hand Google so it doesn’t have to discover every page by crawling links one by one. Simple idea. But I’ve audited plenty of sites where the sitemap was actively working against them: full of redirects, pointing at pages set to noindex, listing URLs that return 404s. A messy sitemap doesn’t just fail to help. It teaches Google to trust your map less.

This guide covers what a sitemap is for, what belongs in it, how to build and submit one, and the mistakes that quietly undermine discovery. It lives under the crawling and indexing hub, right next to its companion file — the robots.txt guide.

The short version

  • A sitemap aids discovery; it does not guarantee indexing
  • List only canonical, indexable, 200-status URLs — nothing else
  • One URL per entry, each in its canonical form (correct protocol, host, trailing slash)
  • Split large sitemaps: 50,000 URLs or 50MB per file, then use an index file
  • Submit it in Search Console and reference it in robots.txt

What a sitemap is actually for

Google finds pages two ways: by following links, and by reading sitemaps. For a small, well-linked site, crawling alone usually finds everything. The sitemap earns its keep when link discovery falls short — large sites, new sites with few backlinks, pages buried deep in the architecture, or content with weak internal linking. It’s also where you signal freshness with the lastmod date so Google knows which pages changed.

What a sitemap is not is a command. Listing a URL doesn’t force Google to index it. The sitemap says “these pages exist and matter to me.” Google still decides what to store based on quality, duplication and value. Treat the sitemap as a strong hint, not a lever.

What belongs in it — and what doesn’t

This is where most sitemaps go wrong. The rule is strict: a sitemap should contain only the URLs you want indexed, each in its canonical form, each returning a 200 status. Every entry that breaks that rule erodes the signal.

The clean-sitemap test

✓ Include

  • Canonical URLs that return a 200 status
  • Pages you actually want in the index
  • The single preferred version of each page
  • An accurate lastmod when content truly changed

✕ Exclude

  • Redirects (301/302) and 404s
  • Noindexed or canonicalized-away pages
  • Parameter, filter and internal-search URLs
  • Non-canonical duplicates and paginated junk

Why so strict? Google uses the gap between what’s in your sitemap and what it chooses to index as a quality read. A sitemap where most URLs are indexed tells Google your map is reliable. A sitemap half-full of redirects and noindexed pages tells it the opposite — and it starts discounting the whole file.

The anatomy of a sitemap

A basic XML sitemap is just a list of URL entries. Here’s the structure:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://yourdomain.com/technical-seo/</loc>
    <lastmod>2026-10-10</lastmod>
  </url>
  <url>
    <loc>https://yourdomain.com/crawling-and-indexing/</loc>
    <lastmod>2026-10-08</lastmod>
  </url>
</urlset>

Two things I’ll flag. First, <loc> must be the exact canonical URL, including the right protocol and host — https:// not http://, with or without www to match your canonical, and the trailing slash your site actually uses. A mismatch here creates a redirect, and we just said no redirects. Second, the old <priority> and <changefreq> tags are ignored by Google. Don’t waste time on them. lastmod is the one optional tag worth setting, and only if it’s accurate.

Sitemap index files and splitting

A single sitemap file caps at 50,000 URLs or 50MB uncompressed. Past that, split into multiple sitemaps and tie them together with a sitemap index file — a sitemap of sitemaps:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://yourdomain.com/sitemap-posts.xml</loc>
  </sitemap>
  <sitemap>
    <loc>https://yourdomain.com/sitemap-pages.xml</loc>
  </sitemap>
</sitemapindex>

Even well under the limit, splitting by content type is worth doing. When you break sitemaps into posts, pages, products and so on, Search Console reports indexing per sitemap — so if 90% of your pages are indexed but only 40% of your products are, you’ve isolated the problem instantly. That diagnostic power is the real reason to segment.

50,000Max URLs per sitemap file
50MBMax uncompressed file size
1Canonical, 200-status version per URL

Building and submitting, step by step

On most platforms you won’t hand-write XML. WordPress with Yoast or Rank Math, Shopify, and modern frameworks all generate sitemaps automatically. Your job is to configure what they include and then verify the output.

  • Generate itLet your CMS or plugin build the sitemap, or generate one with a crawler for a static site.
  • Prune itExclude noindexed pages, taxonomies you don’t want ranked, and anything non-canonical from the config.
  • Submit itAdd the sitemap URL in Search Console under Sitemaps, and add the Sitemap: line to robots.txt.
  • Monitor itWatch the submitted-vs-indexed counts and investigate any sitemap where the gap is wide.

One note for dynamic and JavaScript sites: if you run a single-page app with client-side routing, a sitemap is often the most reliable way for Google to find every view, because there may be few real links to crawl. That ties into JavaScript rendering and SEO — the sitemap gets the URL discovered; rendering decides whether the content survives.

Reading the Search Console sitemap report

After submission, Search Console shows how many URLs you submitted and how many got indexed, plus the Pages report with reasons pages were excluded. This is the feedback loop that makes a sitemap useful. Watch for these patterns:

  • Submitted but not indexed, in large numbers. Usually a quality or duplication issue, not a sitemap bug. The map did its job; the pages didn’t earn the index.
  • “Submitted URL has crawl issue” or 404s. Your sitemap is listing dead URLs. Regenerate it.
  • “Submitted URL marked noindex.” You’re listing pages you’ve told Google to ignore. Pick one instruction — usually, drop them from the sitemap.

These reasons are exactly the kind of thing a full technical SEO audit works through systematically. The sitemap report is often the fastest place to spot an indexation problem because it shows intent (what you submitted) against reality (what got indexed).

Want your sitemap and index coverage reviewed live?We dig into real Search Console data at SEO Spring Training — April 7–11, 2027, Chandler, Arizona.

Get your pass →

XML vs HTML sitemaps — not the same thing

People conflate these constantly, so let’s separate them. An XML sitemap is machine-readable — built for crawlers, listing URLs and metadata in a format no human wants to read. An HTML sitemap is a regular page of links, built for people who want to browse your site structure. They serve different audiences and different jobs.

For modern SEO, the XML sitemap does the heavy lifting on discovery. HTML sitemaps mattered more a decade ago as a crawl aid; today, good internal linking and navigation do that job better. I still build an HTML sitemap occasionally for large sites as a usability and internal-linking asset, but it’s optional. The XML sitemap is the one you submit to Search Console and the one that actually feeds discovery. If you only build one, build the XML version.

Keeping it accurate over time

The failure mode I see most isn’t a bad sitemap at launch — it’s a good sitemap that rotted. You redirect some pages, retire others, change a URL structure, and six months later the sitemap is listing dead and redirected URLs because nobody regenerated it. On a CMS this is usually automatic, but verify it: pull your sitemap, run the URLs through a crawler, and confirm they all return 200 and match their canonical. Make that a line item in your regular crawl and index review. A sitemap is only as trustworthy as its last update, and Google notices when the map stops matching the territory.

Frequently asked questions

Does an XML sitemap help my rankings?

Not directly. A sitemap helps pages get discovered and crawled, which is a prerequisite for ranking, but it isn’t a ranking factor itself. Its value is making sure Google knows your important pages exist and sees when they change.

How often should my sitemap update?

Automatically, every time you publish or meaningfully edit a page — which is what CMS-generated sitemaps do by default. The lastmod date should reflect genuine content changes, not a nightly rebuild that stamps today’s date on everything, which trains Google to ignore the field.

Do I need a sitemap if my site is small?

A small, well-linked site can be fully crawled without one, but there’s no downside to having a sitemap and real upside for diagnostics. I recommend one for every site — it’s free insurance and a useful feedback loop in Search Console.

Should I include images and videos in my sitemap?

You can add image and video extensions to a sitemap, and it’s worth it if visual content is a real traffic source for you — a stock-photo site or a video library. For most sites, a clean URL sitemap is the priority; media extensions are a nice-to-have, not a requirement.

A sitemap is a promise: “these are the pages that matter, and here’s their current state.” Keep that promise honest — only canonical, indexable, live URLs — and Google rewards the file with trust and faster discovery. Let it fill with redirects and noindexed clutter and you’ve handed Google a reason to stop listening. Clean map, clear signal.

Want to go deeper than a guide?Learn this live at SEO Spring Training — Apr 7–11, 2027 · Chandler, AZ.
Get Your Pass →
Terry Samuels

About the author

Terry Samuels

Founder and host of SEO Spring Training — a practitioner-taught digital marketing conference in Chandler, Arizona. Terry writes from real campaigns, not theory.

Last updated October 2026 · Reviewed by the SEOST team
Learn this live at SEOSTApr 7–11, 2027 · Chandler, AZ · Passes from $897
Get Your Pass →