Repository navigation
fix(docs): feed the sitemap module our per-file lastmod - #897
Merged
Merged
Conversation
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.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
@evlog/cli
evlog
@evlog/nuxthub
@evlog/signals
@evlog/telemetry
commit: |
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 4
✨ Finishing Touches
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. Comment |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ownserver/routes/sitemap.xml.tsand registers@nuxtjs/sitemapinstead. Nitro now has two handlers for/sitemap.xml: ours (lazy, scanned fromserver/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 readslastmodfrom amodifiedAtfrontmatter key no page here sets, and it looks for the home page in alandingcollection this app doesn't register.I reproduced it with a local build of
main./sitemap.xmlcame back as the module's output (with/__sitemap__/style.xsl), with 114 URLs and 0lastmod.Fix
apps/docs/server/api/__sitemap__/urls.ts. It shadows Docus's source at the same path and returnscollectSitemapUrls(docs pages, contentCommitDates), the same per-file commit dates and/landingto/rewrite we used before. The module still renders the XML, so there is still exactly one sitemap.apps/docs/server/routes/sitemap.xml.ts, which can no longer win the route, and its test.Tests (
apps/docs/test/sitemap.test.ts)sitemap.sourceshas 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.server/routes/sitemap.xml.ts, since the module handler would shadow it./.Verification
I ran a local
nuxt buildand fetched/sitemap.xmlfrom the built server:lastmodmainThe extra URL is
https://www.evlog.dev/. The build log reports[content-dates] full clone; 488 files, 50 distinct dates.eslint .andvitest run(181 tests) pass inapps/docs, and so does the content lint.