Skip to main content
XMLDir

Search 309 pages — tools, formats, elements, namespaces, directory, comparisons, XPath, datatypes, glossary, parse errors, schema errors, use cases, blog and product.

XML sitemap

<lastmod>

When the page last changed. The one piece of sitemap metadata search engines still act on — and only if you keep it honest.

<lastmod> takes a W3C Datetime: a date alone, or a date and time with a timezone offset. Both are legal, and a bare date is the common choice. What is not legal is any of the other date formats a template might emit — RFC 822, a US-style date, or a timestamp with no offset.

Google has said publicly that it uses lastmod when it is consistently accurate and ignores it entirely when it is not. Stamping every URL with the build time is therefore worse than omitting the element: it costs the signal for every page rather than just the ones that changed.

What it contains

Nothing — this element holds a value rather than other elements. Its content is text, and the constraints below are what that text has to be.

Cardinality and constraints

At most one per <url>.

  • W3C Datetime: 2026-08-10, or 2026-08-10T09:00:00+00:00. A time without an offset is not valid.
  • Should reflect the content's last meaningful change, not the deploy or the crawl.
  • A sitemap where every entry shares one timestamp is treated as having no signal at all.

What our validator does

The validator reports how many entries carry a <lastmod>, warns when none do, and warns when the freshest is more than thirty days old.

Broken and fixed

Both documents below are well-formed XML — that is the point of this corpus — and both are run through the validator on every test run. The verdicts here are what it returned, not what we expect it to.

broken
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url><loc>https://example.com/</loc></url>
</urlset>
No URLs have a <lastmod>; crawlers can't tell what changed.
fixed
<?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-10</lastmod>
  </url>
</urlset>
No errors. Warnings may remain — a conforming feed can still be missing a self link — but nothing here is wrong.

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.