Sub topic 10
Accurate lastmod Values in Sitemaps
Assume you know basic HTML, JSON, and how a crawler retrieves pages. You should also be familiar with the site’s CMS or product data store. This chapter focuses on the sitemap lastmod value, which tells crawlers when a URL’s content was meaningfully changed.
What lastmod means
A sitemap entry can include lastmod, short for “last modified”:
- It records the latest meaningful change to the page at that URL.
- It is a hint to crawlers, not a guarantee that they will crawl the page immediately.
- It should describe the page content, not the time when the sitemap file was generated.
For example, changing a product’s price, stock status, title, or buying instructions can justify a new value. Regenerating the sitemap every hour without changing the page cannot.
A date-only value is often sufficient. Use a full timestamp when the system can reliably track the time of the meaningful change.
| Change | Update `lastmod`? | Reason |
|---|---|---|
| Product price changes from 89.00 to 94.00 | Yes | The page shows a different commercial fact |
| Sitemap is regenerated with no page change | No | The URL content is unchanged |
| Tracking parameter is added to a link | No | The page’s meaning did not change |
| Product description is corrected | Yes | Visible content changed |
Generate it from the content record
The safest design is to store a content revision time with the page or product record. The sitemap generator reads that value instead of using the current server time.
For a product, the revision time should change when a relevant field changes:
- name or description
- price or currency
- availability
- specifications
- canonical URL
- meaningful images or buying information
A stock event may need a different policy from an editorial edit. If inventory changes frequently, update the sitemap only when the page’s visible availability changes in a way that matters to crawlers and shoppers.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/p/trail-runner-2</loc>
<lastmod>2026-11-20T08:00:00+00:00</lastmod>
</url>
</urlset>Use an ISO 8601 date or datetime. Include the time zone when using a timestamp. Keep the value consistent with the page’s actual publication system and do not claim more precision than your data supports.
Avoid date gaming
Changing every lastmod value on every deployment weakens the signal. A crawler may spend time checking unchanged pages while missing pages that actually need attention. It can also make your operational data harder to trust.
Treat a change as meaningful when a visitor would reasonably see different information or make a different decision. Template changes require judgment. If a shared template changes the visible layout but not the page’s facts, you may update affected URLs if your crawl policy requires it. Do not update dates merely because backend code, analytics tags, or cache metadata changed.
Validate the publishing path
A reliable workflow is:
Automated checks should verify that:
- every sitemap URL is canonical and returns the expected status
lastmodis a valid date or datetime- the value is not in the future
- the value does not move backward without an approved correction
- recently changed records appear in the sitemap
- unchanged pages do not receive a new value on every build
When a product is discontinued, remove the sitemap entry only when the URL is retired according to your redirect or removal policy. For a retained page, update lastmod when its status and explanation change.
Exercise
A nightly job sets every sitemap entry to the current date, but only two product pages changed. What should you change?
Show answer
Store a meaningful revision time per page or product and emit that value for lastmod. Leave unchanged URLs at their previous values.