Sitemaps guide
How to use sitemap lastmod correctly
What <lastmod> should measure, which date forms are valid, when to omit it, and why stamping every URL on every deploy destroys the signal.
6 min read · Updated 2026-08-21
The short answer
Set <lastmod> to the time of the page's last significant content change. Use a W3C date or date-time, keep it consistent with the page, and omit it when you cannot calculate it honestly. Do not replace every value with the build or crawl time.Measure the page, not the sitemap file
The value describes the referenced page. Regenerating sitemap.xml, changing its whitespace, or deploying unrelated code does not make every page new.
A significant change includes the main content, structured data, or important links. A rotating footer date or analytics script normally is not a reason to advance lastmod.
Choose a valid precision
A date is enough when your source data only knows the day. Use a date-time when the hour matters, and include Z or an explicit offset. More precision is not more accurate when it was invented by the build.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/handbook</loc>
<lastmod>2026-08-20</lastmod>
</url>
<url>
<loc>https://example.com/releases/42</loc>
<lastmod>2026-08-20T14:35:00+02:00</lastmod>
</url>
</urlset>Make freshness falsifiable
Derive lastmod from a durable content field, not the current clock. Then compare a sample of sitemap values with the pages or records that produced them. If every URL has the same timestamp, the implementation is probably reporting the build rather than the content.
- Store a meaningful updated_at alongside the page record.
- Advance it only for changes users or search engines can observe.
- Serialize it with an explicit timezone when using a date-time.
- Omit lastmod for records whose modification time is unknown.
Prove the fix
- Validate sitemap datesFind malformed and impossible lastmod values in the whole file.
- Inspect <lastmod>See exactly what the protocol permits.
- Monitor sitemap changesTrack freshness and count regressions over time.
Related guides
- How to fix “Sitemap could not be read”A deterministic checklist for separating fetch failures, HTTP problems, malformed XML, namespace mistakes, and invalid sitemap entries.
- How to split a large XML sitemapDivide a sitemap before it crosses protocol limits, build a sitemap index, and choose boundaries that make failures and Search Console reports useful.
Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.