How to Fix Missing or Inaccurate Sitemap lastmod Dates
Your XML sitemap lists URLs but gives search engines no <lastmod> date, or the dates it gives are not tied to real content changes. By the end of this guide, every sitemap entry will carry a correctly formatted <lastmod> that changes only when the page's main content actually changes, and you will have confirmed this in Search Console.

Why it matters
Google and Bing ignore <changefreq> and <priority>, but both use <lastmod> to decide which known URLs to recrawl first, provided the dates prove consistently accurate. Without it, an updated price, policy or article can sit stale in the index and in AI-generated answers for days or weeks. If every URL shows today's date on every deploy, crawlers learn the signal is noise and stop trusting it for the whole site, so accuracy matters as much as presence.
What you need
Step-by-step fix
Locate every sitemap file and count lastmod tags
Open https://example.com/robots.txt and note each Sitemap: line; if there is none, try /sitemap.xml, /sitemap_index.xml and /wp-sitemap.xml. If the file is a sitemap index, open each child sitemap it lists. Count <url> entries against <lastmod> tags so you know whether dates are missing everywhere or only in some files.
curl -s https://example.com/sitemap.xml | grep -c "<url>" curl -s https://example.com/sitemap.xml | grep -c "<lastmod>"
Define what counts as a real content change
Agree on a rule before touching code. Update the date when any of these change:
- Main body text, headings, product price or availability
- Structured data or the page title/meta description
- Important internal links or media in the main content
Do not update it for footer copyright years, sidebar widgets, related-post blocks, comment counts, CSS/JS rebuilds or redeploys.
Source the date from the content's real modified time
Point the sitemap generator at a field that only changes when content changes: the CMS modified/updated_at column, the product's last edit timestamp, or the git commit date of the content file. Avoid build time, new Date(), or file system mtime on servers that redeploy every file. g.
a category page), use the most recent modified date among the items shown.
# Static site: last commit date of a content file in W3C format git log -1 --format=%cI -- content/pricing.md
Output lastmod in W3C Datetime format
Add one <lastmod> per <url>, directly after <loc>. Use either a date (YYYY-MM-DD) or a full timestamp with a timezone offset. Keep the file UTF-8 and under 50,000 URLs / 50 MB uncompressed.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/pricing</loc>
<lastmod>2026-02-11T09:42:00+00:00</lastmod>
</url>
<url>
<loc>https://example.com/blog/sitemap-guide</loc>
<lastmod>2026-01-28</lastmod>
</url>
</urlset>Set lastmod in the sitemap index too
If you use a sitemap index, give each <sitemap> entry a <lastmod> equal to the newest <lastmod> inside that child file. This lets crawlers skip re-downloading child sitemaps that haven't changed.
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemap-posts.xml</loc>
<lastmod>2026-02-11T09:42:00+00:00</lastmod>
</sitemap>
</sitemapindex>Wire it up in your framework (Next.js example)
In the Next.js App Router, app/sitemap.ts returns an array where each item takes a lastModified property. Pass the record's stored update time, not new Date(). Other frameworks follow the same pattern: read the stored timestamp and serialise it as ISO 8601.
import type { MetadataRoute } from 'next'
import { getAllPages } from '@/lib/cms'
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const pages = await getAllPages()
return pages.map((p) => ({
url: `https://example.com${p.path}`,
lastModified: new Date(p.updatedAt),
}))
}Resubmit and confirm the result
Re-run the curl count from step 1. The <lastmod> count should now match the <url> count. In Google Search Console go to Indexing > Sitemaps, enter the sitemap URL and click Submit, then confirm the status reads Success.
In Bing Webmaster Tools use Sitemaps > Submit sitemap. Edit one page, then check that only that URL's date changed.
curl -s https://example.com/sitemap.xml | grep -o "<lastmod>[^<]*</lastmod>" | sort | uniq -c | sort -rn | head
Platform-specific notes
WordPress
The core sitemap at /wp-sitemap.xml does not output <lastmod> by default. Install Yoast SEO, Rank Math or All in One SEO and enable its XML sitemap (Yoast: SEO > Settings > Site features > XML sitemaps). These plugins use the post_modified date. Avoid 'update date on every save' plugins that touch post_modified for trivial edits.
Shopify
Shopify generates /sitemap.xml automatically with <lastmod> from each product, collection, page and article's updated time. You cannot edit the file directly. Bulk inventory or metafield syncs from apps can bump updated_at, so check whether third-party sync apps are touching every product daily.
Wix
Wix creates and maintains the sitemap automatically, including <lastmod>. If dates look wrong, republish only the pages you changed. There is no manual lastmod field to edit.
Webflow
Under Site settings > SEO > Sitemap you can use the auto-generated sitemap or switch it off and paste a custom one. If the auto version lacks or misreports <lastmod> for your site, a custom sitemap generated from CMS item 'Updated On' dates (via the Webflow API) gives you control.
Static sites / Nginx hosting
Generators such as Hugo (enableGitInfo = true with lastmod from :git) and Astro (@astrojs/sitemap with a serialize function) can pull git commit dates. Do not rely on file mtime after a fresh CI checkout, because every file gets the build time.
Check that it worked
✅ How to verify
- Run curl against each sitemap file and confirm the number of <lastmod> tags equals the number of <url> entries.
- Edit one page, regenerate the sitemap, and confirm only that URL's <lastmod> changed while others kept their previous dates.
- In Google Search Console > Indexing > Sitemaps, check the sitemap shows Success with no 'Invalid date' errors.
- Use URL Inspection on the edited page a few days later and confirm the 'Last crawl' date moved after your change.
⚠️ Common mistakes
- Setting every <lastmod> to the build or request time, which makes all dates identical and teaches crawlers to ignore them.
- Using a non-W3C format such as 11/02/2026 or a timestamp without a timezone offset.
- Bumping the date for template-wide changes like a new footer or copyright year across thousands of URLs.
- Adding <lastmod> to child sitemaps but leaving the sitemap index entries without it, or with stale dates.
Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.
Check my site freeFAQ
Does Google actually use the sitemap lastmod date?
Yes. Google has stated it uses <lastmod> as a recrawl signal when the values are consistently and verifiably accurate, and ignores <changefreq> and <priority>. Bing also relies heavily on <lastmod> for crawl scheduling.
Should lastmod be a date or a full timestamp?
Both are valid W3C Datetime formats. A date (2026-02-11) is fine for most sites. Use a full timestamp with a timezone offset (2026-02-11T09:42:00+00:00) if pages can change more than once a day.
Will updating lastmod on every page make Google crawl my site more?
No. Inflating dates without real changes gives no ranking or crawl benefit. Google may start ignoring your <lastmod> values entirely, which slows discovery of genuine updates.
Should lastmod match the 'Updated on' date shown on the page?
Ideally yes, or be very close. If the visible date, the dateModified in your Article structured data, and the sitemap <lastmod> all agree, search engines have a consistent signal to trust.
How to Fix Broken Internal Links That Return 4xx Errors
How to Fix Non-200 URLs in Your XML Sitemap
How to Fix Server Errors (5xx) Found in Your Site Audit
How to Fix a Missing XML Sitemap (and Get It Found)
How to Fix Redirect Chains and Collapse Them to One 301
How to Fix robots.txt Blocking CSS, JS and Key Pages