Skip to content

Conversation

@Vedant005
Copy link
Contributor

@Vedant005 Vedant005 commented Nov 15, 2025

Closes #313

Summary by CodeRabbit

  • New Features
    • Added sitemap generation for the documentation site that aggregates pages from guides, platform docs, self-hosting, API references, and more.
    • Sitemap entries include full URLs and current last-modified timestamps to improve indexing and search engine discovery.

@coderabbitai
Copy link

coderabbitai bot commented Nov 15, 2025

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'path_filters'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

Adds a new Next.js sitemap generator at src/app/sitemap.ts that aggregates pages from multiple sources and returns a MetadataRoute.Sitemap array with full docs URLs and current ISO lastModified timestamps.

Changes

Cohort / File(s) Summary
New Sitemap Generator
src/app/sitemap.ts
Exports default sitemap() function returning MetadataRoute.Sitemap. Collects sources (mainSource, selfHostingSource, platformSource, guideSource, openApiSource, developingSource), calls each source's getPages(), and maps pages to entries with url (https://docs.logchimp.codecarrot.net + page.url) and lastModified (current ISO timestamp).

Sequence Diagram(s)

sequenceDiagram
    participant NextJS as Next.js
    participant SitemapFn as sitemap()
    participant Sources as PageSources
    participant Output as SitemapArray

    NextJS->>SitemapFn: Request sitemap
    activate SitemapFn

    SitemapFn->>SitemapFn: build sources list
    loop for each source
        SitemapFn->>Sources: getPages()
        activate Sources
        Sources-->>SitemapFn: pages[]
        deactivate Sources
        SitemapFn->>SitemapFn: map pages -> { url, lastModified }
    end

    SitemapFn-->>Output: return MetadataRoute.Sitemap
    deactivate SitemapFn
    Output-->>NextJS: sitemap metadata
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Check getPages() availability and return shape for each source.
  • Verify domain concatenation and handling of leading/trailing slashes in page.url.
  • Consider whether lastModified should use page-specific metadata instead of current timestamp.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feat: Sitemap' clearly relates to the main change, which adds a new sitemap generator. It is concise and specific.
Linked Issues check ✅ Passed The PR successfully implements sitemap generation by creating src/app/sitemap.ts that aggregates pages from multiple sources and exports a proper MetadataRoute.Sitemap function, addressing issue #313.
Out of Scope Changes check ✅ Passed All changes are directly related to sitemap generation with no out-of-scope modifications identified.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/sitemap

Tip

📝 Customizable high-level summaries are now available!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide custom instructions to shape the summary (bullet lists, tables, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example:

"Create a concise high-level summary as a bullet-point list. Then include a Markdown table showing lines added and removed by each contributing author."


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.

Copy link

@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: 1

🧹 Nitpick comments (1)
src/app/sitemap.ts (1)

24-24: Consider using actual content modification dates.

Using the current timestamp for all pages means every page appears to have been modified at build time, which doesn't help search engines prioritize fresh content. If the page sources expose actual modification dates (e.g., from file metadata or frontmatter), consider using those instead.

Example approach if sources provide modification dates:

-      lastModified: new Date().toISOString(),
+      lastModified: page.data?.lastModified || new Date().toISOString(),

Note: This assumes the page data includes a lastModified field. If not available, the current approach is acceptable as a fallback.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9dbdb81 and 85c362f.

📒 Files selected for processing (1)
  • src/app/sitemap.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/app/sitemap.ts (1)
src/lib/source.ts (6)
  • mainSource (14-22)
  • selfHostingSource (24-32)
  • platformSource (34-42)
  • guideSource (44-52)
  • openApiSource (54-60)
  • developingSource (62-70)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: vercel_deployment
🔇 Additional comments (2)
src/app/sitemap.ts (2)

1-9: LGTM!

The imports are well-organized and appropriate for implementing a Next.js sitemap generator.


11-19: LGTM!

The function signature correctly implements the Next.js sitemap convention, and aggregating all sources in an array is clean and maintainable.


return sources.flatMap((s) =>
s.getPages().map((page) => ({
url: `https://docs.logchimp.codecarrot.net${page.url}`,
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Move hardcoded domain to environment variable.

The hardcoded domain https://docs.logchimp.codecarrot.net creates maintenance issues and will break in development or staging environments.

Apply this diff to use an environment variable:

-      url: `https://docs.logchimp.codecarrot.net${page.url}`,
+      url: `${process.env.NEXT_PUBLIC_SITE_URL || 'https://docs.logchimp.codecarrot.net'}${page.url}`,

Then add NEXT_PUBLIC_SITE_URL to your .env files for different environments.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
url: `https://docs.logchimp.codecarrot.net${page.url}`,
url: `${process.env.NEXT_PUBLIC_SITE_URL || 'https://docs.logchimp.codecarrot.net'}${page.url}`,
🤖 Prompt for AI Agents
In src/app/sitemap.ts around line 23, replace the hardcoded URL prefix
`https://docs.logchimp.codecarrot.net` with a value read from the environment
(e.g. process.env.NEXT_PUBLIC_SITE_URL) and fall back to a sensible default for
local dev if needed; update the code to build each url as
`${siteUrl}${page.url}` where siteUrl is read once from
process.env.NEXT_PUBLIC_SITE_URL (validate it or throw/console.warn if missing)
and add NEXT_PUBLIC_SITE_URL to your .env files for dev/staging/production.

Copy link

@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: 1

♻️ Duplicate comments (1)
src/app/sitemap.ts (1)

23-23: Move hardcoded domain to environment variable.

The hardcoded domain creates maintenance issues and will break in non-production environments. This was previously flagged in the last review.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 85c362f and e014178.

📒 Files selected for processing (1)
  • src/app/sitemap.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/app/sitemap.ts (1)
src/lib/source.ts (6)
  • mainSource (14-22)
  • selfHostingSource (24-32)
  • platformSource (34-42)
  • guideSource (44-52)
  • openApiSource (54-60)
  • developingSource (62-70)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: vercel_deployment
🔇 Additional comments (2)
src/app/sitemap.ts (2)

1-9: LGTM!

Imports are clean and properly structured for Next.js 15 sitemap generation.


11-19: LGTM!

The function signature correctly implements Next.js sitemap generation, and aggregating sources into an array is a clean approach.

return sources.flatMap((s) =>
s.getPages().map((page) => ({
url: `https://docs.logchimp.codecarrot.net${page.url}`,
lastModified: new Date().toISOString(),
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Use actual modification dates instead of current timestamp.

Setting lastModified to the current time for all pages defeats its purpose and causes search engines to unnecessarily re-crawl all content on every sitemap generation.

Consider these alternatives:

  1. Use the build timestamp (constant across all pages in a build):
+const buildTime = new Date().toISOString();
+
 export default function sitemap(): MetadataRoute.Sitemap {
   const sources = [
     // ...
   ];

   return sources.flatMap((s) =>
     s.getPages().map((page) => ({
       url: `https://docs.logchimp.codecarrot.net${page.url}`,
-      lastModified: new Date().toISOString(),
+      lastModified: buildTime,
     })),
   );
 }
  1. Better: If pages expose modification metadata, use it:
lastModified: page.lastModified || buildTime,
  1. Best: Use git commit dates for each content file (requires integration with your content source).
🤖 Prompt for AI Agents
In src/app/sitemap.ts around line 24, the sitemap currently sets lastModified to
new Date().toISOString() which stamps every page with the current time; change
this to use a stable build-level timestamp or real content modification dates
instead: create a buildTime constant at build/startup and use lastModified:
page.lastModified || buildTime when page metadata provides a modification date,
and if available integrate file/git commit dates per page for the most accurate
value; ensure lastModified is an ISO string and fall back to buildTime only when
no page-specific date exists.

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.

Generate sitemap

2 participants