Losing clicks to competitors? Find out exactly why, and what to fix first.

Show me why
Skip to content

Technical SEO

What Is an XML Sitemap? How to Create and Submit One

Add saadrazaseo.com as a preferred source on Google

Free and no obligation. A real reply from me, not a bot.

Short answer: An XML sitemap is a file, usually at yoursite.com/sitemap.xml, that lists the URLs you want search engines to crawl, optionally with the date each page last changed. To create one, use your CMS or SEO plugin (WordPress and Yoast generate it automatically) or a generator, check it contains only live, indexable, canonical URLs, then submit it in Google Search Console and add it to robots.txt.

50,000 URLsThe most one sitemap file can hold, or 50 MB uncompressed, whichever comes firstGoogle Search Central, 2026
500 pagesBelow roughly this size, with good internal linking, Google says you may not need a sitemap at allGoogle Search Central, 2025
0Weight Google gives to the changefreq and priority tags: it ignores bothGoogle Search Central Blog, 2023

This guide is for site owners, developers and marketers who want a sitemap that actually helps Google find their pages, not just one that exists. You will learn what goes in the file, which tags matter and which are ignored, how to create and submit one on WordPress or any other platform, and how to read the errors Search Console shows you.

What is an XML sitemap?

An XML sitemap is a machine-readable list of the pages, and optionally the images, videos and news articles, on your site. Google describes a sitemap as a file where you provide information about the pages, videos and other files on your site and the relationships between them. It follows the Sitemaps protocol, a shared standard introduced in 2005 and supported by Google, Bing and other search engines.

Think of it as a delivery list you hand to a courier. The courier (Googlebot) can still find addresses by following roads (your internal links, which is how crawling mostly works), but the list makes sure nothing important is missed and tells it which addresses have changed recently.

What a sitemap does not do

  • It is not a ranking factor. A sitemap helps discovery and crawl scheduling. It does not push a page up the results. In my ranking factors list it sits under “confirmed for discovery, not for ranking”.
  • It does not guarantee indexing. Google says a sitemap does not guarantee that everything in it will be crawled and indexed. Submitting one is a hint.
  • It does not override other signals. If a URL in your sitemap is blocked in robots.txt, carries a noindex tag or has a canonical tag pointing elsewhere, those signals win and the sitemap entry just creates a warning.

Do you need an XML sitemap?

Google’s own guidance is that you probably need one if your site is large, new with few external links, or has a lot of rich media or news content. You may not need one if the site is small (about 500 pages or fewer) and every page is reachable through internal links. In practice, since every major CMS generates a sitemap for free, I recommend having one on every site. The question is not whether to have one but whether it is clean.

Your siteSitemap needed?What to focus on
Brochure site, 10 to 50 pagesOptional but freeMake sure it lists only your real pages, not tag, attachment or test URLs
Blog or service site, 50 to 500 pagesRecommendedAccurate lastmod dates so Google rechecks updated posts
Online shop or directory, thousands of URLsEssentialSplit by type (products, categories, posts), exclude filtered and out-of-stock pages you have noindexed
News publisherEssential, plus a news sitemapA separate news sitemap for recently published articles
New site with no backlinksStrongly recommendedSubmit it on day one so Google can discover pages it has no links to

Not sure if this is hurting your site?

Get the fixes that matter most, in priority order.

Find my blockers

What goes inside the file

A basic sitemap is short. Here is a valid example with two pages:

<?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-09-30</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/services/seo-audit/</loc>
    <lastmod>2026-08-14</lastmod>
  </url>
</urlset>

The namespace URL starts with http rather than https. That is correct: it is a reference for parsers, not a link, so do not “fix” it.

Which tags Google uses

TagRequired?How Google treats itMy advice
<urlset>, <url>, <loc>YesThe core of the file. Each <loc> must be a full, absolute URLUse the exact canonical URL, including https and your preferred www or non-www form
<lastmod>NoUsed as a crawl-scheduling signal, but only if it is consistently and verifiably accurateInclude it only if your CMS updates it on real content changes
<changefreq>NoIgnored by GoogleLeave it out or ignore it; it does no harm, but it does nothing
<priority>NoIgnored by GoogleSame: setting your homepage to 1.0 changes nothing

The point about lastmod is worth stressing. In its 2023 announcement, Google said that if a page changed seven years ago but lastmod claims it changed yesterday, it will eventually stop believing your dates. “Last modification” means last significant change: the main text, structured data or links, not a footer tweak or a new copyright year. When I audit WordPress sites, the most common lastmod problem is a theme or plugin that updates every post’s modified date on each save of a sidebar widget, which teaches Google to ignore the field.

Types of sitemaps

  • Standard XML sitemap: lists page URLs. This is what most sites need.
  • Sitemap index: a file that lists other sitemap files. Use it when you have more than 50,000 URLs or want separate files for posts, pages and products. You can submit just the index.
  • Image sitemap: extra image tags inside the standard sitemap, useful when important images are loaded in ways Google might not discover.
  • Video sitemap: details such as title, thumbnail and duration for video content you host.
  • News sitemap: for publishers in Google News, listing recently published articles.
  • HTML sitemap: a normal web page of links for human visitors. It is not a substitute for an XML sitemap, though it can help users and internal linking on large sites.

Google also accepts RSS or Atom feeds and plain text files listing one URL per line, but XML is the format I recommend because it supports lastmod and the media extensions.

How many sitemap files do you need?

Sitemap file calculator

Sitemap files needed3
Sitemap index needed? (1 = yes, 0 = no)1
One file: a single sitemap is enough. You can still use an index if your plugin splits by content type.
Several files: list them all in a sitemap index and submit the index in Search Console. Keep each file well under 50 MB uncompressed.

How to read it: many plugins use smaller files than the limit (Yoast SEO uses 1,000 URLs per file by default), which is fine, because smaller files make errors easier to find.

How to create an XML sitemap

On WordPress

WordPress has produced a basic sitemap at /wp-sitemap.xml since version 5.5. If you use Yoast SEO, Rank Math or All in One SEO, the plugin replaces it with its own, usually at /sitemap_index.xml (this site uses Yoast). Use one sitemap source only. Two plugins producing two sitemaps is one of the messes I clean up most often.

  1. In your SEO plugin, make sure XML sitemaps are switched on.
  2. Exclude content types you do not want indexed: tag archives, media attachment pages, author archives on single-author sites, and any thin custom post types.
  3. Open the sitemap in your browser and click through to each child sitemap to check what is actually listed.

On Shopify, Wix and Squarespace

These platforms generate a sitemap automatically at /sitemap.xml and you cannot edit it directly. Control what appears by hiding or noindexing pages in the platform settings, then submit the sitemap URL in Search Console.

On a custom or static site

Generate the file from your database or build process so it updates when content changes, or use a crawler-based generator for small sites. My free XML sitemap generator builds a valid file from a list of URLs. Save it as UTF-8, place it at the root of your domain, and escape special characters such as ampersands (&amp;).

Worked example: a sitemap index for a shop

A shop with 80,000 products, 600 categories and 300 blog posts could use four files: products-1.xml (50,000 URLs), products-2.xml (30,000), categories.xml and posts.xml. The index file lists those four, each in a <sitemap> entry with its own <loc> and optional <lastmod>. You submit only the index in Search Console, and the Sitemaps report then shows discovered URLs per child file, which makes it easy to see that, for example, products-2 has far fewer indexed pages than products-1.

How to submit your sitemap

  1. Google Search Console: open the Sitemaps report, enter the sitemap or index URL and submit. If you have not verified your site yet, follow my guide to submitting a site to Search Console first.
  2. robots.txt: add a line such as Sitemap: https://www.example.com/sitemap_index.xml anywhere in the file. Every search engine that reads robots.txt can then find it.
  3. Bing Webmaster Tools: submit it there too, or import your site from Search Console.

The old “ping” URL that some plugins and tutorials still mention no longer works. Google deprecated the sitemaps ping endpoint in June 2023 and said it would stop functioning within six months; requests to it now return a 404. Search Console and robots.txt are the supported routes.

Reading sitemap errors in Search Console

What you seeUsual causeFix
Couldn’t fetchWrong URL, the file is blocked by robots.txt, a firewall blocks Googlebot, or the server timed outOpen the URL in a private browser window, check robots.txt and any security plugin or CDN rules
Sitemap is HTMLThe URL returns a web page, often a 404 page or login page, instead of XMLSubmit the exact sitemap URL your plugin produces
Invalid date or parsing errorA malformed lastmod value or an unescaped characterRun the file through a validator and fix the line it reports
Submitted URL blocked by robots.txtThe sitemap lists URLs you have disallowedRemove them from the sitemap, or unblock them if they should be crawled
Submitted URL marked noindexThe sitemap lists noindexed pagesExclude those content types from the sitemap
Discovered URLs much higher than your real page countArchives, parameters or attachment pages are includedTighten exclusions; this is often a sign of index bloat

A sitemap that Search Console reads successfully is only half the job. Compare the URLs in it with the Pages report: if many submitted URLs sit under “Crawled, currently not indexed”, the problem is usually page quality or duplication, not the sitemap, and sometimes index bloat from low-value URLs. My guide to the Search Console coverage report explains each status.

XML sitemap checklist

XML sitemap health checklist

  • One source: only one plugin or system generates your sitemap.
  • Correct location: the sitemap sits at the root of the domain so it can cover every URL.
  • Loads as XML: the URL returns a 200 status and XML, not a web page or redirect.
  • Absolute canonical URLs: every <loc> uses https and your preferred host, matching each page’s canonical tag.
  • Only indexable pages: no noindexed, redirected, 404 or robots-blocked URLs.
  • No thin archives: tag, attachment and empty category pages are excluded unless they are genuinely useful.
  • Honest lastmod: dates change only when content meaningfully changes.
  • Within limits: no file over 50,000 URLs or 50 MB uncompressed; larger sites use an index.
  • UTF-8 and escaped: special characters such as & are entity-escaped.
  • Listed in robots.txt: a Sitemap: line points to the sitemap or index.
  • Submitted: the sitemap is submitted in Google Search Console and Bing Webmaster Tools.
  • Monitored: you check the Sitemaps and Pages reports monthly and after any migration.

Ticks are saved in your browser.

My free sitemap validator checks several of these points automatically, including status codes and URL limits.

Mistakes I see most often

  • Staging or old domain URLs left in the sitemap after a migration, so Google keeps crawling redirects.
  • Sitemaps full of filter and parameter URLs on e-commerce sites, which wastes crawl budget on large stores.
  • Relying on the sitemap instead of internal links. A page that is in the sitemap but linked from nowhere is an orphan, and Google treats orphans as unimportant. Link to it from relevant pages.
  • Submitting and forgetting. Plugins change, content types get added, and nobody checks the sitemap again until traffic drops.

On sites I work on in Pakistan, one specific pattern comes up repeatedly: WordPress sites built from a purchased theme that ships with demo portfolio, testimonial and “team” post types. Those demo items end up in the sitemap, so Google crawls dozens of placeholder pages the owner has never seen. Checking each child sitemap once takes five minutes and catches it.

Frequently asked questions

Where do I find my website’s XML sitemap?

Try yoursite.com/sitemap.xml, /sitemap_index.xml (Yoast and Rank Math) or /wp-sitemap.xml (WordPress core). If none work, open yoursite.com/robots.txt and look for a Sitemap: line, or check the Sitemaps report in Search Console.

Is an XML sitemap required for SEO?

No. Google can find pages through links, and small, well-linked sites can do fine without one. But a sitemap costs nothing on most platforms, speeds up discovery on new and large sites, and gives you useful reports in Search Console, so I treat it as standard.

Does a sitemap improve rankings?

Not directly. It helps Google discover and recrawl pages. Whether those pages rank depends on their relevance and quality, and on links pointing to them.

How often should I update my sitemap?

It should update itself whenever you publish, remove or significantly change a page. CMS and plugin sitemaps do this automatically. You do not need to resubmit it in Search Console after each change; Google rechecks submitted sitemaps on its own.

What is the difference between an XML and an HTML sitemap?

An XML sitemap is written for search engines and is not meant to be read by visitors. An HTML sitemap is an ordinary page of links that helps people navigate. Most small sites do not need an HTML sitemap if their menus are clear.

Should I include images in my sitemap?

Only if Google might not find important images otherwise, for example images loaded by JavaScript. For most WordPress sites, images in normal <img> tags are found without help.

Sources

  • Google Search Central, “Build and submit a sitemap” (last updated 2026).
  • Google Search Central, “Learn about sitemaps” (last updated 2025).
  • Google Search Central Blog, “Sitemaps ping endpoint is going away”, Gary Illyes (June 2023).
  • Sitemaps.org, “Sitemaps XML format” protocol.

If your Search Console reports show a gap between what is in your sitemap and what Google indexes, that gap is usually a technical or content problem worth finding. My technical SEO service covers sitemap, crawl and indexing fixes, or you can send me your sitemap URL with a question.

Is this holding your site back?

Share your website and I will look at the technical issues holding it back.

Your details are only used to reply to your request. No spam.

Grow my trafficCall