An XML sitemap is a file listing the pages on your site that you want search engines to know about. It is a direct way of saying "here is what exists", rather than relying entirely on crawlers finding everything by following links.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-08-01</lastmod>
</url>
<url>
<loc>https://example.com/guides/laptop-buying-guide</loc>
<lastmod>2026-07-15</lastmod>
</url>
</urlset><loc> is the full URL. <lastmod> is when it last meaningfully changed — useful to engines deciding what to re-crawl, but only if it is honest. Setting every page's lastmod to today's date on every build teaches engines to ignore the field entirely.
A sitemap does not guarantee indexing. It is a suggestion, not an instruction. Pages in a sitemap are still evaluated on their merits, and thin or duplicate pages listed there will still be skipped. If a page is not being indexed, adding it to the sitemap again is rarely the fix.
A hand-maintained sitemap goes out of date the first time someone forgets to update it, and a sitemap full of URLs that no longer exist is worse than none — it wastes crawl effort and signals carelessness.
Every serious content system can generate one automatically from its actual content. WordPress does it through plugins; modern frameworks generate it at build time or on request. Whatever the platform, the sitemap should be produced from the same source of truth as the site itself.
Two ways, and you should do both:
robots.txt, which every crawler reads:Sitemap: https://example.com/sitemap.xmlOnly URLs you actually want in search results, and only ones that return a normal 200 response. Leave out redirects, error pages, pages marked noindex, and non-canonical duplicates. A sitemap contradicting your other signals — listing a page you have also told engines not to index — is a confusing message, and engines resolve the contradiction however they choose.
Very large sites can split their sitemap into several files with a sitemap index pointing to them. Below the tens of thousands of URLs mark, one file is fine and simpler.