Skip to content

fix(docs): feed the sitemap module our per-file lastmod - #897

Merged
HugoRCD merged 1 commit into
mainfrom
fix/sitemap-lastmod
Oct 17, 2026
Merged

HugoRCD merged 1 commit into
mainfrom
fix/sitemap-lastmod

Conversation

@HugoRCD

@HugoRCD HugoRCD commented Oct 17, 2026

Copy link
Copy Markdown
Member

Written by an AI agent on behalf of @HugoRCD, who directed the design. @HugoRCD has not reviewed it yet.

Problem

The live https://www.evlog.dev/sitemap.xml has 114 URLs and no <lastmod> at all, so the per-file dates from #847 are gone. The home page is missing too.

The cause is #853. The Docus build it moved to (pkg.pr.new/docus@f0325509) dropped its own server/routes/sitemap.xml.ts and registers @nuxtjs/sitemap instead. Nitro now has two handlers for /sitemap.xml: ours (lazy, scanned from server/routes) and the module's, which is added later and wins. The module builds the sitemap from Docus's source /api/__sitemap__/urls. That source reads lastmod from a modifiedAt frontmatter key no page here sets, and it looks for the home page in a landing collection this app doesn't register.

I reproduced it with a local build of main. /sitemap.xml came back as the module's output (with /__sitemap__/style.xsl), with 114 URLs and 0 lastmod.

Fix

  • Add apps/docs/server/api/__sitemap__/urls.ts. It shadows Docus's source at the same path and returns collectSitemapUrls(docs pages, contentCommitDates), the same per-file commit dates and /landing to / rewrite we used before. The module still renders the XML, so there is still exactly one sitemap.
  • Remove apps/docs/server/routes/sitemap.xml.ts, which can no longer win the route, and its test.

Tests (apps/docs/test/sitemap.test.ts)

  • every local source in Docus's sitemap.sources has a file at the same path in this app. If Docus renames or adds a source, this fails instead of the sitemap quietly losing its dates again.
  • the app ships no server/routes/sitemap.xml.ts, since the module handler would shadow it.
  • the source returns a commit date for every page and lists the home page at /.

Verification

I ran a local nuxt build and fetched /sitemap.xml from the built server:

URLs with lastmod distinct dates
main 114 0 0
this branch 115 115 13

The extra URL is https://www.evlog.dev/. The build log reports [content-dates] full clone; 488 files, 50 distinct dates.

eslint . and vitest run (181 tests) pass in apps/docs, and so does the content lint.

Since the Docus upgrade in #853, @nuxtjs/sitemap owns /sitemap.xml and its handler shadows server/routes/sitemap.xml.ts, so the live sitemap lost every lastmod and the home page. Shadow Docus's /api/__sitemap__/urls source instead, so the module renders our commit dates and lists / again.
@vercel

vercel Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
evlog-docs Ready Ready Preview, v0 Oct 17, 2026 2:49pm UTC
evlog-render-lab Ready Ready Preview Oct 17, 2026 2:49pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
evi Skipped Skipped Oct 17, 2026 2:49pm UTC
evlog-telemetry Skipped Skipped Oct 17, 2026 2:49pm UTC
just-use-evlog Skipped Skipped Oct 17, 2026 2:49pm UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – just-use-evlog October 17, 2026 14:42 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-telemetry October 17, 2026 14:42 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evi October 17, 2026 14:42 Inactive
@github-actions github-actions Bot added the bug Something isn't working label Oct 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@pkg-pr-new

pkg-pr-new Bot commented Oct 17, 2026

Copy link
Copy Markdown
@evlog/cli

npm i https://pkg.pr.new/@evlog/cli@897

evlog

npm i https://pkg.pr.new/evlog@897

@evlog/nuxthub

npm i https://pkg.pr.new/@evlog/nuxthub@897

@evlog/signals

npm i https://pkg.pr.new/@evlog/signals@897

@evlog/telemetry

npm i https://pkg.pr.new/@evlog/telemetry@897

commit: 4044971

@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 91ff3233-63a9-4c00-9805-dab62d688e10
📥 Commits

Reviewing files that changed from the base of the PR and between e9df2a5 and 4044971.

📒 Files selected for processing: 4
  • apps/docs/server/api/__sitemap__/urls.ts
  • apps/docs/server/routes/sitemap.xml.ts
  • apps/docs/test/sitemap-route.test.ts
  • apps/docs/test/sitemap.test.ts
+-------------------------------------------------------------------------------------------------+
| I reached into your code and found nothing there to ease the pressure on my ever-worrying mind. |
+-------------------------------------------------------------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@HugoRCD
HugoRCD merged commit e76a1f9 into main Oct 17, 2026
19 of 21 checks passed
@HugoRCD
HugoRCD deleted the fix/sitemap-lastmod branch October 17, 2026 14:48

This branch was successfully deployed

2 active and 3 inactive deployments
Preview – evlog-docs — 4044971e Deployed Oct 17, 2026 by vercel[bot]
Preview – evlog-render-lab — 4044971e Deployed Oct 17, 2026 by vercel[bot]
Preview – evi — 4044971e Deployed Oct 17, 2026 by vercel[bot]
Preview – just-use-evlog — 4044971e Deployed Oct 17, 2026 by vercel[bot]
Preview – evlog-telemetry — 4044971e Deployed Oct 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant