LuchanLabs IconLuchanLabs
Technical SEO

Sitemap.xml: what it is and how to set it up

Updated: October 17, 20263 min read
Share

Sitemap.xml is an XML file that lists a site's URLs to help search engines discover and crawl its pages. For each address it can carry the last modification date and alternate language versions. The file does not guarantee indexing: it is a hint for the crawler, not a command, and it should contain only canonical pages that return a 200 status code.

How does sitemap.xml work?

A sitemap is a machine-readable list of addresses that a crawler fetches separately from crawling the site itself. Googlebot treats it as an additional source for discovering URLs, then decides on its own what to crawl and index, and when.

File structure

Each page is described by a <url> element with a required <loc> field (the full address). The <lastmod> field, the date of the last meaningful content change, is also useful. Google uses it as a signal for recrawl priority, but only when the dates consistently match reality. Google ignores the <priority> and <changefreq> fields.

Limits and the sitemap index

A single file can hold up to 50,000 URLs and be up to 50 MB uncompressed. Larger sites split their URLs across several files and combine them in a sitemap index, a separate file that points to the other sitemaps.

How search engines find the file

The sitemap address is declared in robots.txt with the Sitemap: directive and/or submitted in the Sitemaps section of Google Search Console.

Why do you need a sitemap.xml?

A sitemap speeds up discovery of new and deeply nested pages that have few internal links, and it gives search engines an explicit list of the URLs the site owner considers primary.

On large sites it helps spend crawl budget more efficiently, and on multilingual sites it lets you declare hreflang relationships without editing the <head> of every page. In Search Console you can also filter the indexing report by sitemap to see the status of the pages you submitted.

Example

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://example.com/ua/page/</loc>
    <lastmod>2026-10-10</lastmod>
    <xhtml:link rel="alternate" hreflang="uk" href="https://example.com/ua/page/"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/page/"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/ua/page/"/>
  </url>
</urlset>

A sitemap index for a site with several files:

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

Declaring the sitemap in robots.txt:

Sitemap: https://example.com/sitemap.xml

What are the most common sitemap mistakes?

Non-canonical or unavailable URLs

Pages that redirect, return 404, carry a noindex tag or point their canonical elsewhere send conflicting signals and waste crawl budget. The sitemap should contain only indexable canonical pages with a 200 status.

Fake lastmod values

If the date is refreshed on every URL at each deploy, Google stops trusting the field. Change lastmod only when the content has actually changed.

URLs blocked in robots.txt

A page listed in the sitemap but disallowed for crawling is a direct conflict: the search engine is told to crawl and not to crawl at the same time.

Wrong protocol or host

Addresses with http:// instead of https://, or with www when the primary version has none, turn the sitemap into a list of redirects. Every <loc> must match the canonical version of the domain.

Exceeding the limits without a sitemap index

Google will not fully process a file over 50,000 URLs or 50 MB. Large sites must split their sitemaps into several files.

How do you check a sitemap?

In Google Search Console open Sitemaps, submit the file address and check its status: "Success" means the file was read, and the number of discovered URLs is shown next to it. If the status is "Couldn't fetch" or errors appear, open the file directly in a browser and validate the XML. Then, in the Page indexing report, choose the sitemap filter to see which submitted pages are not indexed and why.

FAQ

Does a small site need a sitemap.xml?

Not always: if the site is small and its pages are well linked internally, Google will find them on its own. A sitemap costs nothing, though, speeds up discovery of new pages and lets you track their status in Search Console.

Does Google use priority and changefreq?

No, Google ignores both fields. Only lastmod carries weight, and only when the date reflects real content changes rather than being updated automatically.

Can a site have several sitemap.xml files?

Yes. Sites are often split into separate sitemaps by content type (pages, blog, products) and combined in a sitemap index. Each sitemap, and the index itself, can be submitted in Search Console.

Does a sitemap guarantee a page will be indexed?

No. The sitemap only reports that a URL exists. Indexing depends on content quality, technical signals and the page's accessibility.

Related terms

Prepared by the LuchanLabs team

Was this article helpful?