DEV Community

WebToolBench
WebToolBench

Posted on

Your sitemap's lastmod is probably lying (and Google has noticed)

Open your sitemap.xml and look at the <lastmod> values. If every URL shows the same date, including a blog post from 2021, your generator is stamping "now" on every entry each time it rebuilds.

That's worse than leaving the field out. It tells crawlers your whole site changed at once, which obviously isn't true. Once a search engine decides your lastmod values are unreliable, it stops using them. You give up a real signal and get a fake one in return.

What a sitemap actually does

A sitemap helps search engines discover pages. It lists which URLs exist and roughly when they changed. It doesn't make anything rank, and it doesn't guarantee indexing. Google is explicit that it's a hint, not an instruction. It earns its place on large sites, sites with weak internal linking, and new sites with few inbound links.

The fields that matter (and the ones that don't)

  • changefreq and priority are effectively ignored. Everyone set priority to 1.0, so the field stopped carrying information.
  • lastmod is the one optional field worth filling in, but only if it's honest. Update it only when the content actually changes.

The hard limits

50,000 URLs or 50 MB uncompressed per file. Go over either and the file is rejected, not truncated. Large sites split into several sitemaps listed in a sitemap index.

The fix

In WordPress, this is usually a setting in your SEO plugin. On a custom site, build lastmod from each row's updated_at instead of now().

Other things worth checking while you're in there

  • HTTP URLs left over on a site that moved to HTTPS years ago
  • staging URLs that shipped to production
  • a sitemap index pointing at files that no longer exist
  • noindex pages listed in the sitemap (contradictory instructions)

The underlying cause is nearly always the same: the sitemap comes from something nobody has checked since it was installed. If you want a quick look at yours, I put together a free XML sitemap checker. It confirms the file parses, counts the URLs, reports how many carry a lastmod date, and flags anything over the spec limits. Otherwise, opening the file in a browser and reading the first 20 entries will tell you most of what you need.

Top comments (0)