sitemap.xml

Term side of the Card.
Topic: Search Engine Optimization
Unit title: sitemap.xml
Categories: File
Explanation side of the Card

Explanation: The XML file that outlines the structure of a website and provides search engines with information about pages, videos and other resources to improve crawling and indexing.

Example

Wrongxml
<urlset>
  <url><loc>/blog/post-1</loc><priority>1.0</priority></url>
</urlset>
Rightxml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/blog/post-1</loc>
    <lastmod>2026-03-10</lastmod>
  </url>
</urlset>

Locations must be absolute URLs and the namespace is required, while priority is mostly ignored.

Common mistakes

  • Setting every lastmod to the deploy date, so search engines learn to ignore it.

Key points

  • URLs are absolute and canonical and return 200, with no redirects or noindex pages.
  • Each file has at most 50,000 URLs and 50 MB uncompressed, and larger sites use a sitemap index.
  • lastmod reflects real content changes, not the build time of every deploy.
  • The sitemap is listed in robots.txt with a Sitemap: line.

Interview questions

Do I need a sitemap for a small site?

Not usually. Crawlers find well-linked pages on their own, but a sitemap still helps new sites and pages with few links.

Do changefreq and priority matter in a sitemap?

Mostly not. Some search engines ignore them entirely, and an accurate lastmod matters more.

How do I submit a sitemap to search engines?

Add a Sitemap: line to robots.txt and submit the URL in each search engine's webmaster tools.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy