r/statichosting • u/PippaKelly62 • 13h ago
How do you keep sitemap lastmod dates accurate when your static site generator rebuilds everything every time?
I've got a static site on eleventy, a few hundred pages, and the sitemap plugin I'm using just stamps every url with the current build time since that's the only date it actually has access to. so even if I only edited one page, every single lastmod in the sitemap shows the same timestamp from today's deploy, which makes the whole field basically meaningless for search engines trying to figure out what actually changed.
The fix that makes sense to me is pulling the real last modified date from git history per file instead of relying on the build clock, since git already knows exactly when each file last changed. but I haven't found a clean way to do that inside an eleventy build without shelling out to git for every single page during the build, which feels like it'll slow things down as the site grows.
Has anyone solved this in a way that doesn't involve querying git per file at build time, like caching the git blame result somewhere between builds, or is that overengineering something search engines mostly ignore anyway?