Skip to content

feat: add index_page config for content directories#61

Closed
rsbh wants to merge 0 commit into
mainfrom
feat/content-index-page
Closed

feat: add index_page config for content directories#61
rsbh wants to merge 0 commit into
mainfrom
feat/content-index-page

Conversation

@rsbh
Copy link
Copy Markdown
Member

@rsbh rsbh commented May 13, 2026

Summary

  • New index_page option in chronicle.yaml content entries
  • When visiting a content root (e.g., /docs), redirects to the specified page
  • Falls back to first page in tree when index_page is not set
content:
  - dir: docs
    label: Docs
    index_page: getting-started  # /docs → /docs/getting-started

Test plan

  • Set index_page: getting-started in config → /docs redirects to /docs/getting-started
  • Remove index_page/docs redirects to first page in tree
  • Invalid index_page → redirects to the path (404 if page doesn't exist)
  • Regular page navigation unaffected

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented May 13, 2026

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

Project Deployment Actions Updated (UTC)
chronicle Ready Ready Preview, Comment May 13, 2026 6:11am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Warning

Rate limit exceeded

@rsbh has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 38 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: aa797c48-1d10-4f11-b8f2-2eeccb928208

📥 Commits

Reviewing files that changed from the base of the PR and between 7ab1885 and 25828c9.

📒 Files selected for processing (2)
  • packages/chronicle/src/pages/DocsPage.tsx
  • packages/chronicle/src/types/config.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/content-index-page

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.

Comment on lines +29 to +31
if (contentConfig?.index_page) {
return <Navigate to={`/${contentConfig.dir}/${contentConfig.index_page}`} replace />;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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:

Suggested change
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(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Suggested change
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(),

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.

3 participants