sitemap.xml
Example
<urlset>
<url><loc>/blog/post-1</loc><priority>1.0</priority></url>
</urlset><?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
lastmodto the deploy date, so search engines learn to ignore it.
Key points
- URLs are absolute and canonical and return 200, with no redirects or
noindexpages. - Each file has at most 50,000 URLs and 50 MB uncompressed, and larger sites use a sitemap index.
lastmodreflects real content changes, not the build time of every deploy.- The sitemap is listed in
robots.txtwith aSitemap: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.