feat: add index_page config for content directories#61
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ 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 |
e52dc24 to
132834b
Compare
132834b to
c80707f
Compare
c80707f to
ac5f1eb
Compare
| if (contentConfig?.index_page) { | ||
| return <Navigate to={`/${contentConfig.dir}/${contentConfig.index_page}`} replace />; | ||
| } |
There was a problem hiding this comment.
This redirect fires for any 404 under the content directory, not just the content root. If a user navigates to /docs/nonexistent-page, it will still redirect to the index_page instead of showing 404.
Should be guarded with isContentRoot:
| if (contentConfig?.index_page) { | |
| return <Navigate to={`/${contentConfig.dir}/${contentConfig.index_page}`} replace />; | |
| } | |
| if (isContentRoot && contentConfig?.index_page) { | |
| return <Navigate to={`/${contentConfig.dir}/${contentConfig.index_page}`} replace />; | |
| } |
Alternatively, move it after the isContentRoot check so it only applies to the content root URL.
| label: z.string().min(1), | ||
| description: z.string().optional(), | ||
| icon: z.string().optional(), | ||
| index_page: z.string().optional(), |
There was a problem hiding this comment.
nit: might be worth adding a basic guard against path separators and file extensions so users don't accidentally pass something like getting-started.mdx or ../other-dir/page.
| index_page: z.string().optional(), | |
| index_page: z.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/, 'index_page must be a simple slug without path separators or extensions').optional(), |
25828c9 to
3421242
Compare
Summary
index_pageoption inchronicle.yamlcontent entries/docs), redirects to the specified pageindex_pageis not setTest plan
index_page: getting-startedin config →/docsredirects to/docs/getting-startedindex_page→/docsredirects to first page in treeindex_page→ redirects to the path (404 if page doesn't exist)🤖 Generated with Claude Code