XML Sitemap: What It Is and How to Create One

An XML sitemap is a file that lists the URLs on your site you want search engines to know about, often with the date each page last changed. It is a discovery aid in technical SEO: it helps crawlers find pages faster, especially new pages, deep pages and pages with few internal links.

What does a sitemap look like?

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

Google ignores the old priority and changefreq tags but does use lastmod when it is accurate. Large sites split URLs into several sitemaps, listed in a sitemap index file. Each sitemap can hold up to 50,000 URLs or 50 MB.

What should go in your sitemap?

Only canonical, indexable URLs that return a 200 status. Leave out:

  • Redirected URLs.
  • Pages with a noindex tag.
  • Duplicate or parameter URLs.
  • Thin archive pages you do not want ranked.

Mixing in junk URLs sends mixed signals and makes Search Console reports harder to read. Every URL listed should also carry a self-referencing canonical tag.

How to create a sitemap

Most platforms generate one automatically. WordPress SEO plugins such as Rank Math and Yoast create /sitemap_index.xml. Shopify, Wix and Squarespace publish /sitemap.xml. For custom sites, crawlers like Screaming Frog can export a sitemap, or your developer can generate it from the database.

How to submit a sitemap

  1. Open Google Search Console and go to Sitemaps.
  2. Enter the sitemap URL and submit.
  3. Add a Sitemap line to your robots.txt file so all crawlers can find it.
  4. Submit it in Bing Webmaster Tools too.

Specialised sitemaps

  • Image sitemaps help Google find images loaded in unusual ways.
  • Video sitemaps provide titles, durations and thumbnails.
  • News sitemaps list articles from the last two days for Google News publishers.
  • Hreflang in sitemaps is an alternative way to declare hreflang for multilingual sites.

Common sitemap errors

Couldn’t fetch

The URL is wrong, blocked or returns an error. Open it in a browser and check the status code.

Submitted URL not selected as canonical

You listed a URL Google sees as a duplicate. Fix the canonical or remove it from the sitemap.

Submitted URL marked noindex

Remove the URL from the sitemap or remove the noindex tag.

Do small sites need a sitemap?

A site with 20 well-linked pages will be crawled fine without one. A sitemap still helps you monitor indexing in Search Console, so it is worth having.

Frequently asked questions

Does a sitemap guarantee indexing?

No. It helps discovery; Google still decides what to index.

Should I include images in my main sitemap?

Rank Math and Yoast add image entries automatically, which is fine.

Related terms

See orphan pages, crawling and indexing and the SEO encyclopedia.

Mr. SEO is the webmaster at SEO TT - SEO tips and tricks, a publication about all things SEO related.