1. Home
  2. Guides
  3. SEO
  4. XML Sitemaps: How to Build, Submit and Maintain Them
SEO

XML Sitemaps: How to Build, Submit and Maintain Them

By Marketing Ruler Editorial TeamChhaviReviewed by ChhaviUpdated 4 min read
Quick answer

An XML sitemap is a file that lists the URLs you want search engines to discover and index, along with optional details such as when each page was last modified. It helps Google find pages faster, especially on large or new sites. A sitemap is a hint, not a command, so listed pages must still be crawlable and worth indexing.

Key takeaways

  • List only canonical, indexable URLs that return a 200 status code.
  • Each sitemap file can hold up to 50,000 URLs or 50 MB uncompressed.
  • Accurate lastmod dates are useful, while priority and changefreq are ignored by Google.
  • Submit sitemaps in Search Console and reference them in robots.txt.

Which URLs belong in a sitemap?

Include every page you want to appear in search results. That means canonical URLs that return a 200 status, are not blocked by robots.txt and do not carry a noindex tag. Exclude redirects, 404 pages, duplicate parameter versions, paginated sort orders and thin utility pages such as login or thank-you screens.

A clean sitemap becomes a useful diagnostic. When Search Console shows that many submitted URLs are not indexed, you know the problem lies with those specific pages, not with noise from URLs that should never have been listed. A messy sitemap also sends Google conflicting signals about which version of a page you prefer.

  • Canonical version only
  • Returns 200 status
  • Not blocked or noindexed
  • Uses the preferred protocol and host, usually https and one www choice

How should large sites organise sitemaps?

A single sitemap file can contain up to 50,000 URLs and must be no larger than 50 MB uncompressed. Larger sites split URLs across several files and list them in a sitemap index file. Splitting by content type is practical, such as separate files for products, categories, blog posts and store locations.

Segmented sitemaps make Search Console far more useful. You can see indexing rates for each segment and spot, for example, that product pages are indexed well while location pages are not. Most modern CMS platforms and SEO plugins generate split sitemaps automatically. Gzip compression is allowed and saves bandwidth, but the 50 MB limit applies to the uncompressed file.

Worked exampleIllustrative structure for a real estate portal: sitemap_index.xml points to sitemap-projects.xml, sitemap-localities.xml, sitemap-builders.xml and sitemap-blog.xml. When the Sitemaps report shows a much lower indexing share for localities, the team reviews those pages for thin, near-duplicate content.

Do lastmod, priority and changefreq matter?

Google has said it ignores the priority and changefreq values. It does use lastmod when the dates are consistently accurate. That means lastmod should change only when the main content of a page changes meaningfully, not every time a footer updates or the sitemap regenerates.

If every URL shows today's date on every crawl, Google learns your lastmod values are unreliable and may stop trusting them. Configure your CMS to record genuine content updates, which helps Google recrawl refreshed pages sooner. Use the W3C date format, either a plain date or a full timestamp with time zone, such as +05:30 for India.

When do you need image, video or news sitemaps?

Image sitemap extensions help Google find images it might miss, such as those loaded by JavaScript. Video sitemaps provide details like title, description, duration and thumbnail for pages hosting video. These matter for sites where visual search or video results drive traffic, such as recipes, fashion or tutorials.

News sitemaps are only for publishers whose content appears in Google News and should contain articles from roughly the last two days. Most businesses need only a standard sitemap, possibly with image entries for product photos. Adding specialised sitemaps you do not need simply creates more files to maintain and more places for errors to hide.

How do you submit and monitor a sitemap?

Add a Sitemap line to robots.txt with the full URL and submit the sitemap or sitemap index in the Sitemaps report in Search Console. The report shows when Google last read it, its status and how many URLs it discovered. Use the Page indexing report filtered by sitemap to see how many submitted URLs are indexed and why others are not.

Sitemaps can also be submitted to Bing Webmaster Tools, which can import your Search Console setup in a few clicks. Bing data is worth a look because Bing's index feeds several other search and AI products. Submitting there takes minutes and costs nothing.

Check sitemaps after every migration or major release. Broken sitemap generation is a common side effect of plugin updates and theme changes, and it can go unnoticed for months. During a migration, keep the old sitemap available for a short period so Google can find and follow the redirects quickly.

Frequently asked questions

Does submitting a sitemap guarantee indexing?

No. A sitemap helps Google discover URLs, but Google still decides whether each page is worth indexing based on quality, duplication and usefulness. If many submitted pages are not indexed, review those pages for thin content, duplication or weak internal links rather than resubmitting the sitemap repeatedly.

Do small websites need an XML sitemap?

A site with a few dozen well-linked pages can be crawled fully without one. A sitemap is still worth having because it costs almost nothing, speeds up discovery of new pages and gives you useful indexing data in Search Console. WordPress and Shopify generate one automatically.

Should an HTML sitemap replace an XML sitemap?

No. They serve different purposes. An HTML sitemap is a page for visitors that also provides internal links. An XML sitemap is a machine-readable file for search engines. Large sites sometimes use both, but an XML sitemap is the one that feeds Search Console reporting.

Related guides

From other topics