serkankaya.
Türkçe sürüm
Let’s work together ↗

What Is an XML Sitemap? How to Build the Right Sitemap

What is a sitemap, what does it do and which URLs belong in it? XML sitemap example, sitemap index, the lastmod rule and how to submit it to Search Console.

What is a sitemap? The short answer: a sitemap is a file that lists the pages, images and videos on a site that you want indexed, for search engines to read. Its most common format is XML, and it is usually published at /sitemap.xml. Google uses this list to discover pages and to plan which URL to crawl and when.[1]

In this post I explain how an XML sitemap works, which URLs should and should not go in it, the lastmod rule, the sitemap index structure and how to submit the file to Google. A sitemap belongs to the crawling side of technical SEO. I also describe how I handle this work in my own projects on the SEO services page.

What does a sitemap do?

A sitemap lets search engine bots find a site’s important URLs without depending on internal links. Googlebot discovers new pages in two main ways: through links between pages and through the sitemap list the site owner provides. When internal links are weak, or when a page has just been published, the sitemap fills that gap.

The second job of a sitemap is to announce changes. The lastmod value in an entry says when the page was last updated. Google uses this information in re-crawl planning to the extent that it trusts the value to be accurate across the site.[4]

It also helps to know what a sitemap does not do. A sitemap is a hint, not a command. Google does not commit to crawling or indexing every URL on the list.[1] In canonical URL selection, being listed in a sitemap is also a weaker signal than a redirect or a rel="canonical" tag. I cover this in detail in the canonical tag post.

sitemap.xml is published Search Console / robots.txt Googlebot discovers URLs Crawl and index decision
A sitemap speeds up discovery; Google still makes the crawling and indexing decision.

Does every site need a sitemap?

Not every site needs a sitemap, but on large, new or media-heavy sites it makes discovery noticeably easier. Google’s documentation says a sitemap is especially useful in these cases: the site is large, the site is new and has few external links, the site has a lot of video and image content, or the site appears in Google News.[1]

According to the same documentation, a site of about 500 pages or fewer with well-built internal links can be crawled without a sitemap.[1] In practice I still recommend a sitemap for every site. Most modern CMSs generate the file automatically, and a correctly built sitemap has no known downside.

E-commerce sites are a separate case. In a store with thousands of products, filters and category pages, the sitemap works as a clean inventory that shows which URLs are the real pages. I explain how to build that inventory in the e-commerce site architecture post.

What does an XML sitemap look like?

An XML sitemap is a simple file that holds one url entry per page inside the urlset root tag. The only required field in each entry is loc, the page’s full, absolute address. lastmod is optional but valuable when used correctly.[5]

<?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-11-20</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/services/technical-seo/</loc>
    <lastmod>2026-10-02</lastmod>
  </url>
</urlset>

Google’s technical rules are short but strict. The file must be UTF-8 encoded. URLs must be full, absolute addresses starting with https://; relative paths such as /services/ are not accepted.[2] Besides XML, the sitemap protocol also recognises RSS, Atom and plain text (.txt) formats. However, if you want to add image, video or hreflang information, you need the XML format.

Does Google read priority and changefreq?

No. Google states clearly in its own documentation that it ignores priority and changefreq values.[2] These fields are still defined in the protocol and can be left in for other search engines. But the way to tell Google how important a page is runs through internal links and content quality, not these fields.

How should lastmod be used?

lastmod should be updated only when the page’s main content, structured data or links change in a meaningful way. According to Google’s 2023 announcement, small changes such as the copyright year in the footer are not a good enough reason to update lastmod.[4] The date should be given in W3C date format, such as 2026-11-22, or with time information.

Which URLs should go in a sitemap, and which should not?

A sitemap should contain only URLs that you want to appear in Google, that return a 200 status code and that are canonical. A sitemap is a list in which you say “these are my real pages”. Every wrong URL on the list reduces the trust placed in the rest of it.

Belongs in the sitemap

  • Pages that return 200 and should be indexed
  • Self-referencing canonical URLs
  • The single protocol and domain version the site uses (https, with or without www)
  • Newly published and updated content

Does not belong in the sitemap

  • URLs that redirect with 301 or 302
  • Pages with a noindex tag
  • URLs blocked by robots.txt
  • Copies with UTM, session or sort parameters
  • Removed pages that return 404 or 410
The sitemap should point to the same URL as the canonical tag and internal links.

The conflict I see most often is pages that are in the sitemap but carry noindex. These pages show up as errors or warnings in Search Console’s Pages report. Old addresses staying in the sitemap after a site migration is another common case. I cover these indexing problems in the crawled, currently not indexed post.

What is a sitemap index and when do you need one?

A sitemap index is a top-level file that lists several sitemap files under a single URL, and you need one when the single-file limit is exceeded. Under Google’s rules a single sitemap can hold at most 50 MB uncompressed or 50,000 URLs.[2] A site that exceeds this limit splits its URLs into several files and groups them all in a sitemap index.

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

A sitemap index can reference up to 50,000 sitemaps. In Search Console you can submit up to 500 sitemap index files per site.[3] The sitemaps in an index must be hosted on the same site as the index file.[3]

Splitting also helps on sites that are nowhere near the limit. When you separate product, category, blog and image sitemaps, Search Console shows you how much of each group is indexed. That way you find which template has the problem faster.

Do not confuse an XML sitemap with an HTML sitemap made for visitors. An HTML sitemap is a navigation page and supports the internal linking structure; it does not replace the file submitted to search engines.

Image, video and news sitemaps

Image, video and news information can be added to an XML sitemap through extensions. The image extension reports the addresses of the important images on a page. The video extension carries details such as duration and thumbnail. A news sitemap is for publishers that appear in Google News.[1] On multilingual sites, hreflang relationships can also be defined inside the sitemap with the xhtml:link tag.

How do you create a sitemap?

Short answer

How do you create a sitemap?

A sitemap is created by listing the URLs on a site that you want indexed and generating that list automatically in XML format. A hand-made file goes stale quickly. That is why a sitemap should be produced by a system that updates itself as pages are added and removed. The file is then published and reported to Google.

  1. List the inventory of URLs you want indexed
  2. Verify that every URL returns 200 and is canonical
  3. Generate the file automatically with your CMS or framework sitemap feature
  4. On large sites, split the files and group them in a sitemap index
  5. Publish the file in the site root
  6. Submit it to Search Console and add a Sitemap line to robots.txt

The platform you use often generates the sitemap already. Since version 5.5, WordPress core serves a sitemap at wp-sitemap.xml. SEO plugins such as Yoast or Rank Math replace it with their own sitemap_index.xml files. For Shopify stores, sitemap.xml is generated automatically and cannot be edited by hand; I describe the platform’s limits in the Shopify SEO post.

On custom-built sites, the sitemap should be generated dynamically from the database or the content collection. Frameworks such as Next.js and Astro have ready-made solutions for this. Crawling tools such as Screaming Frog can also produce a sitemap. However, this method takes a one-off snapshot and is not suitable for sites that need continuous updates.

How do you submit a sitemap to Google?

A sitemap is submitted to Google through the Sitemaps report in Google Search Console or with a Sitemap: line added to the robots.txt file.[2] Using both methods together is the most robust approach. Search Console shows the submission status and the number of URLs read. The robots.txt line also lets other search engines such as Bing find the file.

User-agent: *
Allow: /

Sitemap: https://www.example.com/sitemap-index.xml
  1. Open Search Console

    Select your verified property and open the Sitemaps report under Indexing in the left menu.

  2. Enter the sitemap URL

    Type the file path into the Add a new sitemap field. If you use a sitemap index, submitting only the index file is enough.

  3. Check the status

    You should see Success in the Status column. If it says Couldn’t fetch or shows an error, check that the file returns 200 and that its XML structure is valid.

  4. Compare with the Pages report

    Open the Pages report with the sitemap filter. This is where you see why submitted URLs were not indexed.

I explain how I read Search Console’s reports in detail in the how to use Google Search Console post. Sending a request to Google’s old “ping” address no longer works. Google announced in 2023 that it was deprecating this endpoint, and requests to it now return a 404 error.[4]

Common sitemap issues in Search Console

Most problems in the Sitemaps report come from the file’s accessibility or from the URLs it contains. These are the cases I run into most often:

  • Couldn’t fetch: Google could not reach the file. Check that the file opens in a browser, returns 200 and is not blocked by robots.txt. A firewall or bot protection may be blocking Googlebot.
  • Sitemap is HTML: The sitemap URL returns an HTML page instead of XML. This usually happens when the wrong address was entered or when the server redirects to the home page instead of returning a 404.
  • Invalid date or URL: The lastmod format is wrong or the URLs are written as relative paths. Convert dates to W3C format and addresses to absolute https:// URLs.
  • Submitted URL marked noindex: The sitemap and the page tag contradict each other. If you want the page indexed, remove the tag; if you do not, take the URL out of the sitemap.
  • Fewer URLs discovered than expected: Sitemap generation may be skipping a template. Compare the number of URLs in the file with the number of live pages in the database.

Running these checks once a month is enough for most sites. After a site migration, a domain change or a major URL structure change, however, the report needs regular monitoring for the first two weeks. During that period old addresses should be removed from the sitemap and new ones added.

Bing, Yandex and IndexNow

Bing and Yandex also read the sitemap from their own webmaster tools and from the robots.txt line. These search engines additionally support the IndexNow protocol, which reports changed URLs instantly. Because Google does not take part in IndexNow, the sitemap keeps its place on the Google side. I explain how the two methods work together in the what is IndexNow post.

Sitemap checklist

I use the list below when launching a new site and after a migration. Every item can be verified with Search Console or a crawling tool.

XML sitemap checklist0/8

Conclusion

An XML sitemap is a list in which you tell Google “these are the real pages I want indexed”. Its value is decided not by the file’s existence but by the list’s accuracy. When the sitemap points to the same URL as the canonical tag, internal links and redirects, it speeds up discovery. When it contradicts them, it blurs the signal.

As a next step, I recommend comparing your own sitemap with the Pages report in Search Console. Submitted but unindexed URLs point either to addresses that should not be in the sitemap or to a content problem that needs fixing. If you also want to review access rules for AI crawlers, take a look at the AI crawlers and robots.txt post.

Key terms

Sitemap index
A sitemap index is a top-level XML file that groups several sitemap files under a single URL. Under Google's rules a sitemap index can reference up to 50,000 sitemaps, which lets large sites split their URLs by type or section.
lastmod
lastmod is a tag in a sitemap entry that states, in W3C date format, when the page's content last changed in a meaningful way. Google uses this value for re-crawl planning only when it is consistently and verifiably accurate across the site.
HTML sitemap
An HTML sitemap is a navigation page that presents a site's important pages to visitors as a list of links on a normal web page. Unlike an XML sitemap, it is made for people and works as part of the internal linking structure.

Frequently asked questions

What is a sitemap?

A sitemap is a file that lists a site's important pages, images and videos for search engines. Its most common format is XML, and it is usually published in the site's root directory as sitemap.xml. Search engines use this list to discover pages and to plan the order in which they crawl them.

Does every site need a sitemap?

No. According to Google's documentation, a site of about 500 pages or fewer, with good internal links and little media, can be crawled without a sitemap. Still, a sitemap does no harm, and on large, new or frequently updated sites it makes discovery noticeably easier.

Does a sitemap affect SEO?

A sitemap is not a direct ranking signal. Its effect shows up in faster discovery of pages and in re-crawling of updated pages. Adding a URL to a sitemap does not guarantee that it will be indexed either; Google treats the list as a hint.

How do I submit a sitemap to Google?

The most practical way is to open the Sitemaps report in Google Search Console and enter the sitemap URL. Adding a Sitemap: line to the robots.txt file also lets Google find the file. Google's old ping endpoint was deprecated in 2023, so it no longer works.

Should I use priority and changefreq in my sitemap?

Google states clearly that it ignores priority and changefreq values. Adding these fields is not an error, but they have no effect on Google's side. It is better to signal updates with lastmod, and only when the page has actually changed.

Sources

  1. Google Search Central: Site haritaları hakkında bilgi edinme
  2. Google Search Central: Site haritası oluşturma ve gönderme
  3. Google Search Central: Büyük site haritalarını yönetme (sitemap index)
  4. Google Search Central Blog: Sitemaps ping endpoint is going away (2023)
  5. Sitemaps.org: Sitemap protokolü