feat: support draft frontmatter to hide pages#84
Conversation
Add `draft?: boolean` to Frontmatter type. Draft pages are filtered from page tree (sidebar), flat page list (search, sitemap, llms.txt), and prev/next navigation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Draft pages return 404 on direct URL access (SSR) and /api/page endpoint. Prevents rendering draft content even with direct link. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR adds draft page support to Chronicle. Pages can now be marked with ChangesDraft Page Support
Sequence DiagramsequenceDiagram
participant User
participant EntryServer
participant PageAPI
participant SourceLayer
participant PageData
User->>EntryServer: Request docs page
EntryServer->>SourceLayer: getPage(slug)
SourceLayer->>PageData: Load frontmatter
PageData-->>SourceLayer: Returns page with draft: true
SourceLayer-->>EntryServer: rawPage (draft detected)
EntryServer->>SourceLayer: isDraft(rawPage)
SourceLayer-->>EntryServer: true
EntryServer->>EntryServer: Set page = null
EntryServer-->>User: 404 Not Found
User->>PageAPI: GET /api/page/slug
PageAPI->>SourceLayer: getPage(slug)
SourceLayer->>PageData: Load frontmatter
PageData-->>SourceLayer: Returns page with draft: true
SourceLayer-->>PageAPI: page (draft)
PageAPI->>SourceLayer: isDraft(page)
SourceLayer-->>PageAPI: true
PageAPI-->>User: 404 Not Found
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 |
Summary
draft: truefrontmatter support to hide pages from sidebar, prev/next nav, search, sitemap, and llms.txt/api/page)Usage
Test plan
/api/pagereturns 404 for draft