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.

By Updated ⏱ 30-60 minutes🎯 Intermediate● Low impactTechnical
Illustration: Sitemap lastmod accuracy fix guide
TECHNICAL · FIX GUIDE Sitemap lastmod accuracy IMPACTEFFORT TIME30-60 minutes LEVELIntermediate

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.

✕Before<url><loc>https://example.com/pricing</loc></url>(no <lastmod> on any entry)✓After<url><loc>https://example.com/pricing</loc><lastmod>2026-02-11T09:42:00+00:00</lastmod></url>

What you need

The URL of your XML sitemap (or sitemap index)
Access to your CMS settings, SEO plugin, or the code that generates the sitemap
A terminal with curl, or a browser to view raw XML
Google Search Console and/or Bing Webmaster Tools access

Step-by-step fix

1

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.

text
curl -s https://example.com/sitemap.xml | grep -c "<url>"
curl -s https://example.com/sitemap.xml | grep -c "<lastmod>"
Pro tip: Fetch the file twice a few minutes apart. If every <lastmod> value changes between requests, the generator is stamping the current time, not the content's modified date.
2

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.

Pro tip: Write this rule into your content team's style guide so editors know that fixing a typo in the footer won't, and shouldn't, trigger a recrawl signal.
3

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.

text
# Static site: last commit date of a content file in W3C format
git log -1 --format=%cI -- content/pricing.md
Pro tip: Never set <lastmod> to a date later than the page's visible 'Updated on' date, and never in the future. Mismatches are a common reason crawlers discount the field.
4

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.

html
<?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>
Pro tip: Drop <changefreq> and <priority> if you like. Google ignores both, and they only add bytes.
5

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.

html
<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>
6

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.

javascript
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),
  }))
}
Pro tip: If your CMS bumps updatedAt on every save, including unpublished draft saves, use a separate contentUpdatedAt field that your publish workflow sets only on meaningful edits.
7

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.

text
curl -s https://example.com/sitemap.xml | grep -o "<lastmod>[^<]*</lastmod>" | sort | uniq -c | sort -rn | head
Pro tip: If the uniq output shows one identical timestamp on hundreds of URLs, the dates are still build-generated. Go back to step 3.

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 free

FAQ

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.