Skip to main content

How to Fix Sitemap lastmod: 114 of 176 Dates Were Wrong

How to fix sitemap lastmod: derive it from real content edits. 114 of 176 dates here were stale, a 26-post rewrite moved none, and indexing did not care.

• • 7 min read
Dashboard cover for a post on fixing sitemap lastmod: post files and their git history flow into a body-diff check that flags sitemap dates older than the last real content edit

TL;DR — How to fix sitemap lastmod: stop reading it from a hand-edited frontmatter field and derive it from the last commit that changed the article body, then fail CI when the two disagree. On this site 114 of 176 posts carried a lastmod older than their last real edit, by a median of 49 days, and a 26-post rewrite moved none of them. Fixing it is about recrawl trust, not indexing: stale and accurate posts were indexed at the same 90% rate.

lastmod is the one sitemap field Google still reads. It tells a crawler “this URL changed on this date, come back.” It only works if it is honest, and on a static blog it almost never is, because the date lives in a frontmatter field that a human has to remember to bump.

The numbers below come from this site’s own repository on November 13, 2026: every published post, its full git history, and the sitemap template that turns frontmatter into <lastmod>.

What Does Google Do With Sitemap lastmod?

Google’s sitemap build guide is short on this. It says Google “uses the <lastmod> value if it’s consistently and verifiably accurate,” and that the value “should reflect the date and time of the last significant update to the page.” It also says, flatly, “Google ignores <priority> and <changefreq> values.”

Bing’s lastmod post says the same thing from the other side. It reports that 84% of sitemaps on hosts with an indexed URL set lastmod, and that Bing “largely disregards” changefreq and priority because sites fill them with the same values everywhere.

So of the four per-URL fields in the sitemap protocol, one carries signal. Here is what each one does today:

FieldGoogleBingWhat it should contain
<loc>UsedUsedThe canonical URL
<lastmod>Used if consistently accurateUsed, strongly recommendedDate of the last significant content change
<changefreq>IgnoredLargely disregardedNothing, if you want to save bytes
<priority>IgnoredLargely disregardedNothing, if you want to save bytes

“Significant” has a definition too. Google counts a change to “the main content, the structured data, or links on the page.” A copyright year does not count. That matters for the audit below: adding a related-reading link to an old post is a significant change, so it should move lastmod.

How Did This Site Get lastmod Wrong?

The template is one line. The blog sitemap sets lastmod to post.updatedDate || post.publishDate, both read from frontmatter. Nothing else feeds it.

That design is the bug. Every edit path on this site touches post bodies without touching updatedDate:

  • Inbound links. Each new post adds a related-reading sentence to one or two older posts. That is a links change, which Google calls significant, and nobody bumps the older post’s date.
  • Bulk rewrites. On August 5, 2026 one commit raised 26 older posts from a C/D audit grade to an A, rewriting intros, adding FAQ and sources. Not one updatedDate moved.
  • Fix-ups. Broken links, typo fixes, swapped diagrams. Small, but real body changes.

Only 13 of 176 posts had an updatedDate at all. The other 163 report their publish date forever.

What Did the Audit Find on 176 Posts?

The audit walks every commit that touched each published post, splits the file into frontmatter and body, and asks one question per commit: did the body change, and was that after the date the sitemap reports?

ResultPostsShare
lastmod accurate (no body edit after it)6235%
lastmod stale by a small edit (10 lines or fewer)7341%
lastmod stale by a medium edit (11-49 lines)1710%
lastmod stale by a rewrite (50+ lines)2414%
Total published posts176100%

The gap between the reported date and the last body edit had a median of 49 days and a maximum of 674 days. The worst case was the React performance post: lastmod 2024-11-20, five body edits since, the last on 2026-09-25. Five more posts had frontmatter-only edits after their lastmod, such as a reading-time recompute, and the audit correctly left those alone.

Stacked bar of 176 published posts by sitemap lastmod accuracy: 62 accurate, 73 stale after a small edit of 10 lines or fewer, 17 stale after a medium edit, and 24 stale after a rewrite of 50 lines or more; median lag 49 days

Read that against Google’s wording. “Consistently and verifiably accurate” does not survive a sitemap where two posts in three report the wrong date and Googlebot can see the changed HTML on its next fetch. Google has not published a threshold, so I can’t tell you this sitemap is distrusted. I can tell you it gives Google no reason to trust it.

How to Fix Sitemap lastmod in 6 Steps

  1. Measure before you change anything. For each post, list the commits that touched it with git log --follow --format=%H@%cs -- <file>, and keep the ones dated after the sitemap’s current lastmod.

  2. Diff the body, not the file. For each of those commits, compare the content after the frontmatter --- with the same content in the parent commit. Frontmatter-only commits (tags, reading time, category remaps) are not significant and should not move the date.

  3. Decide what “significant” means for you, in writing. Following Google’s definition, a link change counts, so any body change counts. If you want a floor, set it in lines and apply it everywhere. The worst outcome is a rule that changes per commit.

  4. Backfill updatedDate once. Write the date of the last significant body commit into updatedDate for every stale post. On this site that is 114 files in one reviewed commit, plus dateModified in the BlogPosting schema, which reads the same field.

  5. Fail CI when they drift. Run the same diff on every pull request: if a post’s body changed and updatedDate did not, fail the check. Bumping the date by hand stays the workflow, but forgetting is no longer silent.

  6. Drop changefreq and priority, or at least stop tuning them. This site sets changefreq=daily and priority=1.0 for posts under 48 hours old. Google ignores both. The freshness signal you actually have is lastmod, so spend the effort there.

The core of the check is about 25 lines of Node:

JavaScript
import { execSync } from 'node:child_process';
const sh = (c) => execSync(c, { encoding: 'utf8' });
const body = (t) => t.replace(/^---\n[sS]*?\n---\n?/, '').trim();

export function lastSignificantEdit(file, lastmod) {
  const commits = sh(`git log --follow --format=%H@%cs -- ${file}`)
    .trim().split('\n').filter(Boolean).map((l) => l.split('@'));
  for (const [hash, date] of commits) {        // newest first
    if (date <= lastmod) break;
    let prev;
    try { prev = sh(`git show ${hash}~1:${file}`); } catch { break; } // file created here
    if (body(sh(`git show ${hash}:${file}`)) !== body(prev)) return date;
  }
  return null;                                 // lastmod is accurate
}

Two traps when you run it. A shallow clone has no history, so run git fetch --unshallow first or every post looks accurate. And --follow matters for renamed files, or a renamed post reports a single commit.

Does a Stale lastmod Stop Indexing?

This is the part that surprised me. I joined the audit against the repository’s Search Console URL Inspection report from October 2, 2026, recomputing staleness as of that date so the two snapshots line up. 156 posts had a verdict:

Sitemap lastmod as of Oct 2IndexedCrawled, not indexedIndexed rate
Stale87990.6%
Accurate54690.0%

Bar chart comparing Google indexing rate for 156 posts on October 2, 2026: 90.6 percent of the 96 posts with a stale sitemap lastmod were indexed versus 90.0 percent of the 60 posts with an accurate one

No difference. That fits what lastmod is for. It is a recrawl-scheduling hint for URLs Google already knows. It does not decide whether a page is worth indexing. The posts stuck in “Crawled - currently not indexed” are there for content reasons, and an honest date would not have rescued one of them.

So why fix it? Because the cost of a stale date is delay, not exclusion. When the August rewrite improved 26 posts, the sitemap told Google nothing had changed. Googlebot found the new versions on its own schedule. An accurate lastmod is how you ask it to come back sooner, and that request only works if your dates have been honest the rest of the time.

When Is a Stale lastmod Worth Fixing?

Site shapeRisk from stale lastmodWhat to do
Blog that rarely edits old postsLowBackfill once, add the CI check
Blog with heavy inbound linking or rewritesMedium: improvements go unannouncedBackfill, CI check, bump on every body edit
Docs site that changes with each releaseHigh: stale docs stay stale in searchDerive from content history in the build
News or e-commerce with price and stock changesHigh: freshness is the productGenerate from the data layer, not frontmatter
Site that sets lastmod to build timeWorse than missingFix this first; every deploy cries wolf

The last row deserves emphasis. A build-time lastmod moves every URL on every deploy, which is the textbook way to teach a crawler to ignore the field. The same deploy problem shows up at the HTTP layer, where serving Googlebot a 304 Not Modified fails because every build rewrites every page’s hashed asset name.

What Breaks If You Get lastmod Wrong?

  • Build-time dates. Every URL changes on every deploy. Search engines learn the field means nothing on your site.

  • Bumping on frontmatter edits. A tag rename moves 40 posts’ dates for no content reason. That is the same noise in smaller doses.

  • Forgetting link edits. Google counts links as significant. If your inbound-linking routine edits old posts, those dates must move.

  • Auditing in a shallow clone. CI checkouts often fetch one commit. The audit then finds zero stale posts and passes.

  • Letting sitemap and schema disagree. If <lastmod> says one date and BlogPosting.dateModified says another, you hand the crawler two answers. Feed both from one field.

  • Expecting indexing gains. As the table above shows, an honest lastmod speeds up recrawls of known pages. It does not move a page out of “Crawled - currently not indexed.”

How This Fits the Rest of a Technical SEO Audit

lastmod answers “when should a crawler come back?” The neighbouring checks answer the others. Whether every sitemap URL is reachable by a link is the orphan-page audit. Whether Googlebot is let in at all is the Cloudflare bot-blocking problem. Whether paginated archives are linked correctly is the rel=next header audit. For agents rather than search engines, making a site agent-readable covers the machine-facing side. What to do when a crawled post still is not indexed is splitting stuck pages by age and last crawl. If Search Console can’t read the sitemap at all, fixing Sitemap couldn’t fetch separates a real fetch failure from Google deferring the file. The AI search hub collects the rest.

FAQ

Does Google use the lastmod date in a sitemap?

Yes, but only conditionally. Google’s sitemap documentation says it uses lastmod if the value is consistently and verifiably accurate, which means it matches when the page actually changed. If your dates are wrong often enough, the safe assumption is that Google stops trusting them for that sitemap.

What counts as a significant update for lastmod?

Google lists changes to the main content, the structured data, or the links on the page as generally significant. A copyright year bump or a template tweak is not. A practical rule is to compare the rendered article body before and after the commit and bump lastmod only when it changed.

Should I remove changefreq and priority from my sitemap?

You can. Google says it ignores both, and Bing says it largely disregards them because sites set them to the same values everywhere. They do no harm, but they are bytes that carry no signal, and keeping them can make you think you are sending a freshness hint when you are not.

Can I just set lastmod to the build time?

No. A build-time lastmod changes every URL on every deploy, which is exactly the inconsistent signal that makes a search engine stop trusting the field. lastmod should move only for pages whose content changed, so it has to come from content history, not from the clock.

Will fixing lastmod get my pages indexed?

Probably not on its own. On this site, posts with a stale lastmod were indexed at 90.6 percent and posts with an accurate one at 90.0 percent. lastmod is a recrawl-scheduling hint for pages Google already knows about, so its payoff is that edits get picked up sooner, not that new pages get indexed.

Sources

Frequently asked questions

Share this article:
X LinkedIn

Google Search · Preferred sources

Prefer this site on Google

If you already read this writing, add umesh-malik.com as a Preferred Source. Google can then highlight it with a preferred badge in Top Stories, AI Overviews, and AI Mode — for you, not as a site-wide ranking boost.

Keep reading

Get new posts on AI, Claude Code & LLMs

New deep-dives on AI engineering, Claude Code, and developer tooling — follow along however you prefer.