Conversation
✅ Deploy Preview for docs-novu ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/app/sitemap.ts (1)
9-20: Consider removing the unnecessary async/await wrapper sincepage.datais synchronous.Based on the codebase patterns,
page.datafields are synchronously available in Fumadocs MDX. In[[...slug]]/page.tsx, all accesses topage.data(body, title, description, full, toc, etc.) are synchronous. The currentPromise.allandasync/awaitin 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.
What Changed
Files Modified
src/app/[[...slug]]/page.tsxsrc/app/sitemap.tsSummary by CodeRabbit