What a sitemap is for

An XML sitemap is a list of URLs you are asking a crawler to consider, in the format defined by sitemaps.org. It is a discovery aid: it does not raise a page's position, does not cause a page to be indexed, and does not override anything the page says. Google's documentation describes it as a hint rather than an instruction.

Its value is coverage. A crawler finds new URLs by following links, so a page nothing links to, or one buried six clicks deep, can sit undiscovered for a long time. A sitemap states the addresses directly, and an accurate <lastmod> tells the crawler which are worth revisiting.

The markup, element by element

ElementRequiredRules
<loc>One per <url>A fully qualified URL including scheme and host; relative paths are invalid, reserved characters must be escaped as XML entities, and the value stays under 2,048 characters.
<lastmod>NoW3C Datetime. YYYY-MM-DD is the common form; a full timestamp with an offset is also valid.
<changefreq>Noalways, hourly, daily, weekly, monthly, yearly or never. The specification calls it a hint, and Google states it ignores it.
<priority>NoA decimal from 0.0 to 1.0, defaulting to 0.5. It ranks your own URLs against one another only, and Google states it ignores it too.

The document is wrapped in <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> and served as UTF-8. Two limits apply per file: 50,000 URLs and 50 MB uncompressed. Past either one you split the URLs across several files and list those in a sitemap index — a <sitemapindex> whose entries point at child sitemaps, and which may itself hold up to 50,000 children. The limit applies to the uncompressed document.

All URLs in one sitemap must belong to a single host. Mixing www with the bare domain, or http with https, splits them across hosts. The file can live at any path, conventionally https://example.com/sitemap.xml, and a Sitemap: line in robots.txt must give that full absolute URL.

A concrete file

The generator's two default rows, with frequency and priority filled and no date entered, produce this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
</urlset>

A date is emitted as <lastmod>2026-09-08</lastmod>, and only when it is a complete YYYY-MM-DD value. The bulk box keeps only pasted lines beginning with http:// or https://, so stray headings and bare domains are dropped silently.

Where this goes wrong

Common questions

How often should the file be regenerated?

Whenever the set of URLs changes — a manual step after a deploy on a small site, generated from the content store on a large one. The <lastmod> values should come from real modification dates, not the build clock.

Can a sitemap list alternative-language versions?

Yes. The xhtml namespace allows xhtml:link rel="alternate" hreflang="..." inside each <url>, one of the three supported ways to declare hreflang relationships. The same reciprocity requirements apply as with link tags.

Does submitting a sitemap guarantee indexing?

No. Discovery and indexing are separate steps, and the second depends on the page's content, its canonical status and the site's overall signals.

Can a sitemap list URLs that carry query strings?

Yes, when those URLs are the canonical ones you want indexed. Session and filter parameters that produce duplicate content belong outside the file.