Skip to content

feat: update canonical urls#1053

Merged
paulgrape merged 1 commit intomainfrom
feat-update-canonical-urls
Feb 26, 2026
Merged

feat: update canonical urls#1053
paulgrape merged 1 commit intomainfrom
feat-update-canonical-urls

Conversation

@paulgrape
Copy link
Contributor

@paulgrape paulgrape commented Feb 26, 2026

What Changed

  • Added/updated canonical URL handling for documentation pages.
  • Updated sitemap generation behavior.

Files Modified

  • src/app/[[...slug]]/page.tsx
  • src/app/sitemap.ts

Summary by CodeRabbit

  • Chores
    • Added canonical URL metadata to improve content attribution across pages
    • Enhanced sitemap structure with explicit root entry and reorganized page listings

@netlify
Copy link

netlify bot commented Feb 26, 2026

Deploy Preview for docs-novu ready!

Name Link
🔨 Latest commit 252db31
🔍 Latest deploy log https://app.netlify.com/projects/docs-novu/deploys/69a05eef092ce10007defc2d
😎 Deploy Preview https://deploy-preview-1053--docs-novu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

📝 Walkthrough

Walkthrough

The pull request adds canonical URL metadata to the page metadata and refactors sitemap generation to explicitly include a root entry with separate page handling, improving SEO structure.

Changes

Cohort / File(s) Summary
SEO Metadata Enhancements
src/app/[[...slug]]/page.tsx, src/app/sitemap.ts
Added canonical URL to page metadata via alternates object. Refactored sitemap generation to extract pages into a separate array and include an explicit root entry with weekly changeFrequency and priority 1, filtering out root from the pages array.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hopping through metadata, tail held high,
Canonical paths beneath the sky,
Sitemaps organized with care,
Root entries sitting front and fair,
SEO dreams now take their flight! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: update canonical urls' is partially related to the changeset. While it accurately describes one of the changes (adding canonical URLs in page.tsx), it does not capture the main structural change: reorganizing the sitemap with an explicit root entry and separate pages array.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-update-canonical-urls

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
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.

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

9-20: Consider removing the unnecessary async/await wrapper since page.data is synchronous.

Based on the codebase patterns, page.data fields are synchronously available in Fumadocs MDX. In [[...slug]]/page.tsx, all accesses to page.data (body, title, description, full, toc, etc.) are synchronous. The current Promise.all and async/await in lines 9-20 adds unnecessary overhead.

Simplified version:

♻️ Synchronous refactoring
 export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
   const url = (path: string): string => new URL(path, baseUrl).toString();
-  const pages = await Promise.all(
-    source.getPages().map(async (page) => {
-      const { lastModified } = await page.data;
-
-      return {
-        url: url(page.url),
-        lastModified: lastModified ? new Date(lastModified) : undefined,
-        changeFrequency: 'weekly',
-        priority: 0.5,
-      } as MetadataRoute.Sitemap[number];
-    })
-  );
+  const pages = source.getPages().map((page) => ({
+    url: url(page.url),
+    lastModified: page.data.lastModified ? new Date(page.data.lastModified) : undefined,
+    changeFrequency: 'weekly',
+    priority: 0.5,
+  } as MetadataRoute.Sitemap[number]));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/sitemap.ts` around lines 9 - 20, The Promise.all + async wrapper is
unnecessary because page.data is synchronous; update the pages construction in
sitemap.ts to map synchronously over source.getPages() and read page.data
directly (remove the async arrow and awaiting of page.data), returning objects
with url(page.url), lastModified computed from page.data.lastModified,
changeFrequency 'weekly' and priority 0.5 to match MetadataRoute.Sitemap
entries; adjust any type assertions (MetadataRoute.Sitemap[number]) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/app/sitemap.ts`:
- Around line 9-20: The Promise.all + async wrapper is unnecessary because
page.data is synchronous; update the pages construction in sitemap.ts to map
synchronously over source.getPages() and read page.data directly (remove the
async arrow and awaiting of page.data), returning objects with url(page.url),
lastModified computed from page.data.lastModified, changeFrequency 'weekly' and
priority 0.5 to match MetadataRoute.Sitemap entries; adjust any type assertions
(MetadataRoute.Sitemap[number]) accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d2361bd and 252db31.

📒 Files selected for processing (2)
  • src/app/[[...slug]]/page.tsx
  • src/app/sitemap.ts

@paulgrape paulgrape merged commit 60d315f into main Feb 26, 2026
7 checks passed
@paulgrape paulgrape deleted the feat-update-canonical-urls branch February 26, 2026 15:13
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