Skip to content

Fix sitemap lastmod regression from PR #539 merge - #540

Closed
timujinne wants to merge 1 commit into
BeamLabEU:devfrom
timujinne:fix/sitemap-lastmod
Closed

Fix sitemap lastmod regression from PR #539 merge#540
timujinne wants to merge 1 commit into
BeamLabEU:devfrom
timujinne:fix/sitemap-lastmod

Conversation

@timujinne

Copy link
Copy Markdown
Contributor

Summary

PR #539 (V117 migration) was merged with a silent sitemap regression. The 3-way merge overwrote two sitemap helpers that existed on upstream/dev but had been removed long ago on the source fork — restoring them.

What broke after PR #539

FileBefore mergeAfter merge
lib/modules/sitemap/sources/publishing.exlastmod: latest_post_date(slug, language)lastmod: nil
lib/modules/sitemap/sources/static.ex (lines 202, 227)lastmod: static_lastmod(path)lastmod: Date.utc_today()
defp latest_post_date/2presentdeleted
defp static_lastmod/1presentdeleted

SEO impact of the regression:

  • Publishing group listing pages (/blog, /posts, …) lost their <lastmod> element entirely
  • Static homepage / now reports lastmod: today's date on every sitemap regeneration — a known SEO anti-pattern

Fix

Restores both files to their state at 0b561d1b — the last upstream/dev commit before the PR #539 merge. Both helper functions (latest_post_date/2, static_lastmod/1) and their callsites come back.

Original commits that introduced this logic:

  • e7b0ef60 Add lastmod to sitemap group listings and homepage
  • 54b9b899 Add lastmod to sitemap router-discovered and static entries

Test Plan

  • mix compile --warnings-as-errors clean
  • mix docs clean
  • mix quality (credo + dialyzer) clean
  • Pre-commit hook passed
  • Verify sitemap XML output on a parent app — group listing pages should emit <lastmod> again, homepage <lastmod> should reflect latest publishing content rather than today's date

Context

Detailed pre-merge analysis: dev_docs/pull_requests/2026/539-v117-document-composition-tables/CLAUDE_REVIEW.md (already on dev via commit 17b3b6e1) — see section "#1 Undeclared scope: PR also reverted the dynamic-lastmod sitemap logic on dev".

PR BeamLabEU#539's 3-way merge silently overwrote two sitemap helpers that
existed on upstream/dev but not on the source fork:
- lib/modules/sitemap/sources/publishing.ex: restore latest_post_date/2
used for publishing group listing lastmod
- lib/modules/sitemap/sources/static.ex: restore static_lastmod/1 with
cross-source homepage lookup
Files restored to their state at 0b561d1 (last upstream/dev commit
before the PR BeamLabEU#539 merge).
Behavior restored:
- Publishing group listings emit <lastmod> from latest post date
- Homepage / emits <lastmod> from latest publishing content across groups
- Other static pages keep Date.utc_today() baseline (unchanged)
Original commits that added the helpers (now restored):
- e7b0ef6 Add lastmod to sitemap group listings and homepage
- 54b9b89 Add lastmod to sitemap router-discovered and static entries
Full analysis in
dev_docs/pull_requests/2026/539-v117-document-composition-tables/CLAUDE_REVIEW.md
section "#1 Undeclared scope".
@ddon

ddon commented May 13, 2026

Copy link
Copy Markdown
Contributor

Thanks for catching this @timujinne — your diagnosis matches exactly what the post-merge review of #539 turned up, and the citation to CLAUDE_REVIEW.md (section #1 "Undeclared scope") is the right pointer.

Closing this in favor of 29fe377c, which already landed on dev and does the same restore plus a small perf improvement:

  • Sources.Publishing.latest_post_date/2 — restored verbatim (drives per-group-listing <lastmod>), same as your PR.
  • Sources.Static.static_lastmod/1 — restored, same call-sites (static.ex:202,227), but "/" routes through a new Sources.Publishing.latest_post_date_global/0 instead of Publishing.collect/1.
  • Sources.Publishing.latest_post_date_global/0 — new public helper. Old shape called Publishing.collect/1 from static_lastmod("/") just to discard everything except :lastmod, which itself triggers ~3× list_posts/2 calls per group inside collect/1 (via group_has_posts_for_language?, latest_post_date, and collect_group_posts). New shape does one list_posts/2 walk per group, returns max published_at. Semantically equivalent to max(collect/1 entries' lastmod) since group-listing :lastmod IS the per-group max post date.
  • CHANGELOG entry under 1.7.110### Fixed.

mix precommit clean. No test coverage on either helper before or after — same gap as pre-merge dev. If you want a follow-up PR to add LiveView-test-style coverage on the sitemap sources I'd be glad to review.

Sorry for the duplicate work — both branches were investigating in parallel and ours just landed first.

@ddonddon closed this May 13, 2026
@timujinne
timujinne deleted the fix/sitemap-lastmod branch May 14, 2026 05:47
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@timujinne@ddon