Skip to content

feat(site): add sitemap#7723

Open
mhartington wants to merge 2 commits intomainfrom
site-sitemap
Open

feat(site): add sitemap#7723
mhartington wants to merge 2 commits intomainfrom
site-sitemap

Conversation

@mhartington
Copy link
Copy Markdown
Member

@mhartington mhartington commented Mar 27, 2026

Adds two sitemaps for the new site.

  • sitemap.xml for the "host" project. This indicates the sitemaps for blog/docs/site apps.
  • sitemap-site.xml is the auto-generated sitemap for the site app.

Summary by CodeRabbit

  • New Features

    • Automatic XML sitemap generation that discovers and catalogs public site pages
    • Sitemap index endpoint plus a site-specific sitemap endpoint to improve search engine discoverability
  • Refactor

    • Replaced static sitemap configuration with a dynamic route-based system that stays in sync with site structure changes

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

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

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Mar 27, 2026 7:29pm
docs Ready Ready Preview, Comment Mar 27, 2026 7:29pm
eclipse Ready Ready Preview, Comment Mar 27, 2026 7:29pm
site Ready Ready Preview, Comment Mar 27, 2026 7:29pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8ab3e794-5d82-4f4a-92f6-efc38276b2a9

📥 Commits

Reviewing files that changed from the base of the PR and between e8f96ca and d4fe2b5.

📒 Files selected for processing (3)
  • apps/site/src/app/sitemap-site.xml/route.ts
  • apps/site/src/app/sitemap.xml/route.ts
  • apps/site/src/lib/sitemap.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/site/src/app/sitemap.xml/route.ts
  • apps/site/src/app/sitemap-site.xml/route.ts

Walkthrough

Replaces Next.js metadata sitemap with custom XML endpoints and a new sitemap utility. Adds two GET route handlers that return sitemap index and site sitemap XML, and introduces a library to discover app routes and render sitemap XML. Removes the legacy metadata-based sitemap module.

Changes

Cohort / File(s) Summary
Sitemap Utilities Library
apps/site/src/lib/sitemap.ts
New module that discovers public App Router page routes by scanning src/app, filters out group/private/dynamic segments, builds absolute sitemap URLs and entries, and provides renderSitemapIndexXml() and renderSitemapXml() to produce escaped XML documents.
Sitemap Route Handlers
apps/site/src/app/sitemap.xml/route.ts, apps/site/src/app/sitemap-site.xml/route.ts
New GET handlers exporting dynamic = "force-static" that fetch sitemap URLs/entries, render XML via the new library, and return Response with Content-Type: application/xml; charset=utf-8.
Removed Legacy Route
apps/site/src/app/sitemap.ts
Removed the Next.js metadata route module (revalidate and default sitemap() export) previously providing a metadata-based sitemap.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'feat(site): add sitemap' directly and clearly summarizes the main change: adding sitemap functionality to the site application.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@argos-ci
Copy link
Copy Markdown

argos-ci bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Mar 27, 2026, 7:34 PM

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/site/src/app/sitemap-site.xml/route.ts`:
- Around line 3-11: The sitemap route handler GET is dynamic by default, causing
regeneration on every request; make it statically cached by exporting the route
cache hint—add an export like export const dynamic = 'force-static' (or the
project-standard static cache export) alongside the GET handler so
getSiteSitemapEntries()/renderSitemapXml runs at build time or is cached instead
of per-request.

In `@apps/site/src/app/sitemap.xml/route.ts`:
- Around line 3-11: The sitemap index route is being treated as dynamic; add a
module-level segment config to force static caching by exporting the dynamic
flag. In the route module (where the GET function is defined) add an export
const dynamic = "force-static"; at top-level so Next.js will statically cache
the rendered sitemap XML instead of regenerating it per request.

In `@apps/site/src/lib/sitemap.ts`:
- Around line 53-55: collectPageRoutes currently lets readdir errors bubble up
which can cause 500s; wrap the call to readdir(directory, { withFileTypes: true
}) in a try/catch inside collectPageRoutes, and on error log the error (e.g.,
console.error or app logger) and return an empty array so sitemap generation
continues gracefully instead of throwing; keep the rest of collectPageRoutes
logic unchanged so it can operate on an empty entries list when filesystem
access fails.
- Around line 27-33: Extract the segment filtering logic into a single helper
(e.g., isRenderableSegment or isRouteSegmentValid) and use it from
toRouteSegment and the other place where segments are filtered to remove
duplication; the helper should return false for: route groups and explicit
intercepting routes like "(.)", "(..)", "(...)" and any other "(group)"
patterns, private segments that start with "_" or bracketed dynamic segments
like "[id]", and parallel route slots that start with "@" (e.g., "@sidebar",
"@modal"); update toRouteSegment to call this helper and make the
intercepting-route checks explicit rather than relying on the generic
startsWith("(")&&endsWith(")") check, then replace the duplicated filtering
block elsewhere in the file with a call to the same helper.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c98167ff-4301-467c-97b7-fca00b3106b1

📥 Commits

Reviewing files that changed from the base of the PR and between 3ff13d5 and e8f96ca.

📒 Files selected for processing (4)
  • apps/site/src/app/sitemap-site.xml/route.ts
  • apps/site/src/app/sitemap.ts
  • apps/site/src/app/sitemap.xml/route.ts
  • apps/site/src/lib/sitemap.ts
💤 Files with no reviewable changes (1)
  • apps/site/src/app/sitemap.ts

Cache the sitemap routes statically and make route discovery skip unsupported segments and filesystem read failures.

Made-with: Cursor
Sign up for free to 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