seo: roll up sitemap lastmod from newest descendant on branch pages - #21036
seo: roll up sitemap lastmod from newest descendant on branch pages#21036workprentice[bot] wants to merge 1 commit into
Conversation
Section, taxonomy, term, and home pages in the sitemap were reporting only their own _index.md git-commit date, not the newest date among the content they render. This produced demonstrably wrong lastmod values -- e.g. /blog/ claimed 2024-05-16 while its newest post published 2026-08-14, a 2+ year gap on a page that changes constantly. Google treats sitemap lastmod reliability as a sitewide signal (Gary Illyes, 2026-07-16): once it catches enough wrong dates it stops trusting lastmod across the whole site, not just the offending URLs. A stale date on a high-traffic index page like /blog/ is worse than omitting lastmod entirely. Fix: for Kind in (home, section, taxonomy, term), compute lastmod as max(own .Lastmod, newest .RegularPagesRecursive .Lastmod) before emitting it. Leaf pages are untouched -- old-but-honest leaves like /tutorials/glossary/* and static pages like /trademark/ keep their real dates. Verified in an isolated Hugo harness: nested sections roll up transitively, taxonomy/term pages roll up across tagged content, a section with no children keeps its own date, and leaf pages are unaffected.
Pre-merge Review — Last updated 2026-08-21T12:21:45ZTip Summary: Infrastructure-only change to Review confidence:
Investigation log
🔍 Verification trail2 claims extracted · 0 verified · 1 unverifiable · 0 contradicted
🚨 Outstanding in this PRNo outstanding findings in this PR.
|
|
Your site preview for commit 9b4253d is ready! 🎉 http://www-testing-pulumi-docs-origin-pr-21036-9b4253d4.s3-website.us-west-2.amazonaws.com |
Lighthouse Performance ReportCommit: 9b4253d | Metric definitions
|
What
Sitemap
<lastmod>for section/taxonomy/term/home pages now rolls up to the newest lastmod among the pages they render, instead of reporting only the branch page's own_index.mdgit-commit date.Why
Root-caused today via a live sitemap audit:
/blog/reports lastmod2024-05-16T10:42:54-07:00(826 days old) while its newest post, "Compatibility Testing Pulumi HCL," published 2026-08-14. Sixteen URLs share that identical stamp (/blog/,/why-pulumi/,/automation/,/careers/, and others), all touched by the same one-time bulk commit --enableGitInfo: truesets.Lastmodfrom the content file's git history, and Hugo does not roll a branch page's.Lastmodup from its descendants.That is not merely stale, it is actively wrong:
/blog/changes constantly and the sitemap is claiming otherwise. Gary Illyes confirmed (2026-07-16) that Google evaluates lastmod trustworthiness sitewide, not per-URL, and stops trusting the field across an entire site once it catches enough incorrect dates -- so a wrong date on a high-traffic index page carries a cost well beyond that one URL.Fix
In
layouts/_default/sitemap.xml, for pages whose.Kindishome,section,taxonomy, orterm, computelastmod = max(own .Lastmod, newest descendant's .Lastmod via .RegularPagesRecursive)before emitting it. Leaf pages (.Kind == "page") are untouched, so genuinely static, old-but-honest content --/tutorials/glossary/*,/trademark/,/acceptable-use/,/awards/-- keeps its real date. No fabricated dates: the rollup only ever surfaces a real, already-existing.Lastmodvalue from a real descendant page.Verification
Built an isolated Hugo harness (minimal site, real
layouts/_default/sitemap.xmltemplate, synthetic content tree with explicitlastmodfront matter) covering:All eleven pages in the harness sitemap emitted exactly the expected
<lastmod>value; no XML malformed, no unexpected date on any leaf.Scope
layoutsis fully excluded from prettier (.prettierignore), so no formatting step applies. This is a template-only change with no content or front-matter edits.🧠 This PR was created by workprentice on behalf of the Pulumi SEO/AEO daily optimization assignment.