XML Sitemaps: Why They Matter & How to Build One

An XML sitemap lists preferred URLs to assist discovery. It supplements links but does not ensure that every URL is discovered, crawled or indexed. Keep internal navigation useful and use accurate sitemap entries, particularly for large or frequently changing sites.

Why Sitemaps Matter

Search engines don't need sitemaps to crawl your site, but sitemaps provide several concrete advantages:

  • Discovery assistance: A sitemap supplies URLs directly, which can help discovery without guaranteeing speed, crawling or indexing.
  • Additional discovery: A sitemap can expose URLs missing from internal navigation. Orphan URLs may also be discovered from external links or previously known URLs; fix navigation where useful.
  • Metadata delivery. The lastmod element tells crawlers when a page was last updated, which can influence how frequently they re-crawl it.
  • Diagnostics: The Sitemaps report shows fetch/processing status and discovered URLs. Use Page indexing, including sitemap filters where available, to investigate indexing; discovered URLs are not an indexed count.
Sitemaps are most valuable for: large sites (10,000+ pages), new sites with few backlinks, sites with many orphan pages, and JavaScript-heavy sites where content may not be easily discoverable through link crawling.

Sitemap Structure & Syntax

An XML sitemap follows a strict schema defined by the sitemaps.org protocol. Here's the basic structure:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/page/</loc>
    <lastmod>2026-04-10</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.8</priority>
  </url>
</urlset>

Required vs Optional Elements

ElementRequired?DescriptionBest Practice
<loc>YesThe full, absolute URL of the pageUse canonical URLs only. Include protocol (https://)
<lastmod>NoLast modification date (W3C Datetime format)Use accurately — only update when content actually changes
<changefreq>NoHow often the page changes (always, hourly, daily, weekly, monthly, yearly, never)Google ignores changefreq. Other engines may differ; consult their current documentation rather than assuming the field is required.
<priority>NoRelative importance (0.0 to 1.0)Google ignores this. Default is 0.5 if omitted

Use valid loc values and accurate lastmod dates for significant changes when known. Google ignores changefreq and priority; do not generalize that policy to every search engine or invent update dates.

Sitemap Index Files

A single sitemap can contain a maximum of 50,000 URLs and must not exceed 50 MiB (52,428,800 bytes) (uncompressed). For larger sites, use a sitemap index file that references multiple sitemaps:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://example.com/sitemap-posts.xml</loc>
    <lastmod>2026-04-10</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap-products.xml</loc>
    <lastmod>2026-04-09</lastmod>
  </sitemap>
</sitemapindex>

Organize sitemaps logically — split by content type (posts, products, categories) or by section. This makes debugging easier and lets you see indexing rates per content type in Search Console.

Submitting to Search Engines

There are three main ways to tell search engines about your sitemap:

  1. Google Search Console: Submit the sitemap URL in the Sitemaps report and inspect fetch status, errors and discovered URLs. Use the Page indexing report separately for indexing reasons. Submission does not guarantee indexing.
  2. Bing Webmaster Tools: Submit a sitemap using its supported workflow. IndexNow is a separate URL-change notification protocol for participating engines, not an instant indexing guarantee.
  3. robots.txt directive: A Sitemap line can help supporting crawlers find a sitemap. It is optional and does not guarantee that every search engine will fetch or use it.

Auto-Generation vs Manual

For most sites, auto-generating sitemaps is the right approach. Manual maintenance becomes unsustainable beyond a few dozen pages.

  • CMS plugins — WordPress (Yoast SEO, Rank Math), Shopify (built-in), and most modern CMS platforms generate sitemaps automatically.
  • Static site generators — Jekyll, Hugo, Next.js, and Gatsby all have sitemap plugins or built-in generation.
  • Crawl-based tools — Screaming Frog and Sitebulb can crawl your site and generate sitemaps from discovered URLs.
  • Manual creation — only practical for small, static sites. Useful when you need precise control over exactly which URLs are included.

Best Practices

  • Include the preferred, indexable URLs you want in Search and keep annotations consistent. Redirects, errors and noindexed URLs can make a sitemap less useful, but each such entry does not imply measurable crawl-budget harm.
  • Keep sitemaps current and lastmod dates accurate. Google uses lastmod when it is consistently verifiable; inaccurate dates may be ignored, rather than creating a general “crawler trust” score.
  • Use HTTPS URLs. All <loc> entries should use HTTPS if your site uses HTTPS. Mixing protocols causes confusion.
  • Gzip can reduce sitemap transfer bytes and is supported by Google and Bing. Fetching time also depends on server, network and processing conditions; uncompressed sitemap limits still apply.
  • Monitor in Search Console: Compare sitemap processing with the relevant Page indexing data and inspect representative URLs. Different report scopes or delays can affect counts; investigate actual reasons rather than treating every difference as an error.
  • Don't exceed limits. Respect the 50,000 URL and 50 MiB (52,428,800 bytes) limits per sitemap file. Use sitemap index files to organize larger sets.

When Sitemaps Help Most

Sitemaps provide the most value in specific scenarios:

  • Large websites where some pages may be difficult to discover through internal links. Ten thousand pages is not an eligibility threshold.
  • New websites with few links may benefit from sitemap discovery assistance, without a promised indexing speed.
  • JavaScript-heavy sites where content is rendered client-side and link discovery through HTML parsing is limited.
  • Sites with orphan pages — content that exists but isn't linked from other pages on your site.
  • Frequently updated sites can supply accurate lastmod dates for significant changes. These may inform crawling but do not guarantee prioritized or immediate recrawling.

A sitemap can still be useful on a small well-linked site, although it may add less discovery value. It must remain accurate; neither links nor sitemaps guarantee discovery of everything.

Try It Yourself

Generate a URL sitemap with namespace declarations and optional, user-supplied lastmod dates. Unknown dates are omitted. This generator does not create sitemap index files; use another workflow to organize multiple sitemaps.

Sitemap Generator →

Frequently Asked Questions

Sitemaps are optional and can help discovery, especially for large or new sites or URLs with few links. They do not ensure crawling, indexing or faster inclusion. Maintain crawlable navigation and accurate sitemap URLs.
Update your sitemap whenever you add, remove, or significantly modify pages. For dynamic sites with frequent content updates (news sites, blogs, e-commerce), automate sitemap generation so it always reflects the current state. For static sites, update manually when you publish new content. The lastmod date should only change when the page content actually changes — don't update it artificially to trick crawlers.
Google ignores sitemap priority and changefreq. Other crawlers may interpret protocol hints differently. Neither field guarantees a crawl schedule or ranking outcome.
For ordinary discovery sitemaps, list canonical, indexable URLs you want in search. Avoid noindex, redirected, broken or private URLs. A sitemap is a hint, not a directive to index, and this guide does not establish a universal de-indexing delay from mixed signals.
There are two methods: (1) Submit through Google Search Console under the Sitemaps section — paste your sitemap URL and click Submit. (2) Add a Sitemap directive to your robots.txt file: "Sitemap: https://example.com/sitemap.xml". Google retired its old sitemap "ping" endpoint (google.com/ping?sitemap=...) at the end of 2023, so pinging no longer does anything. The Search Console method is preferred because it provides submission status, error reporting, and indexing statistics.