feat(seo): enumerate CMS routes in sitemap.xml and llms.txt - #348
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR centralizes SEO route enumeration so sitemap.xml and /llms.txt can list both static routes and (optionally) Sanity-backed CMS content, while also unifying absolute URL construction via a single exported BASE_URL.
Changes:
- Added
lib/seo/routes.tswithSTATIC_ROUTESplusgetCmsRoutes()to fetch and normalize Sanity documents into routable paths. - Updated
app/sitemap.tsandapp/llms.txt/route.tsto consume the shared route helper so both surfaces enumerate the same URLs. - Exported
BASE_URLfromlib/seo/site.tsand updatedapp/robots.ts/app/sitemap.tsto use it for absolute URLs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/seo/site.ts | Exports normalized BASE_URL for consistent absolute URL construction. |
| lib/seo/routes.ts | Introduces shared static + Sanity CMS route enumeration logic. |
| app/sitemap.ts | Builds sitemap entries from STATIC_ROUTES and getCmsRoutes() using BASE_URL. |
| app/robots.ts | Switches sitemap URL to use BASE_URL. |
| app/llms.txt/route.ts | Adds CMS-derived Content section via getCmsRoutes(). |
| CHANGELOG.md | Documents the new sitemap + /llms.txt behavior and BASE_URL unification. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+121
to
+124
| const path = urlForReference({ | ||
| linkType: 'internal', | ||
| internalLink: { _type: doc._type, slug: doc.slug }, | ||
| }) |
Comment on lines
+110
to
+112
| const parsed = z.array(routableDocumentSchema).safeParse(data) | ||
| if (!parsed.success) return [] | ||
|
|
Comment on lines
+48
to
+50
| const links = cmsRoutes | ||
| .map((route) => `- [${route.label}](${SITE.url}${route.path})`) | ||
| .join('\n') |
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.
What this does
A fork that keeps Sanity no longer throws away the sitemap and llms.txt and rewrites them: both now enumerate the CMS content automatically, through one shared helper, and a fresh clone with no CMS env still gets the static routes. A configured-but-broken CMS (bad project id, deleted dataset) degrades to static routes instead of 500ing the sitemap — found and reproduced during verification, not in the original issue.
Closes #319.
Summary
Review order
Test Plan