Repository navigation
Show all blog posts on single page - #1731
Conversation
📝 WalkthroughWalkthroughUpdated Docusaurus blog configuration to show all posts on one page and updated sidebar labels; added a new BlogSidebarContent React component that can group sidebar items by year and collapsible months, rendering either a grouped hierarchy or a flat list. Changes
Sequence Diagram(s)sequenceDiagram
participant Theme as Docusaurus Theme
participant Sidebar as BlogSidebarContent
participant Year as YearGroup
participant Month as CollapsibleMonthGroup
participant List as ListComponent
Theme->>Sidebar: render(items, ListComponent, config)
alt groupByYear enabled
Sidebar->>Year: group items by year (descending)
Year->>Month: group items by month (descending) and compute initialOpen
Month->>List: render month items (collapsible)
Month-->>Sidebar: emit expand/collapse events
else groupByYear disabled
Sidebar->>List: render flat items list
end
Sidebar-->>Theme: rendered sidebar DOM
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ 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 |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1731 +/- ##
==========================================
+ Coverage 68.92% 68.93% +0.01%
==========================================
Files 381 381
Lines 34930 34930
==========================================
+ Hits 24074 24079 +5
+ Misses 8592 8588 -4
+ Partials 2264 2263 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
3191ca8 to
abe4e78
Compare
abe4e78 to
1e156df
Compare
4d2170f to
08d233d
Compare
Extended blog sidebar with collapsible month sections. Only the most recent month is expanded by default, older months are collapsed to reduce clutter. Features: - Clickable month headings with chevron icons (like docs sidebar) - Auto-expand most recent month (October 2025) - Smooth rotation animation on chevron (0deg → 90deg) - Accessible with aria-expanded attribute - Year/Month hierarchy: 2025 > October > Posts Configuration changes: - blogSidebarCount: 'ALL' - Show all posts in sidebar - blogSidebarTitle: 'All posts' - Updated title - postsPerPage: 'ALL' - Disable pagination Implementation: - Swizzled @docusaurus/theme-classic BlogSidebar/Content component - Custom groupBlogSidebarItemsByYearMonth() function - CollapsibleMonthGroup component with React state - Nested year/month headings with proper styling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
08d233d to
3dc513f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
website/src/theme/BlogSidebar/Content/index.tsx (1)
73-140: Refactor inline styles to CSS classes and enhance accessibility.The component has extensive inline styles (lines 89-137) that should be extracted to CSS classes for better maintainability. Additionally, accessibility could be improved with
aria-controlslinking.Consider extracting styles to a CSS module:
// In a separate .module.css file .monthGroup { margin-left: 0.5rem; } .monthButton { display: flex; align-items: center; width: 100%; background: none; border: none; padding: 0; cursor: pointer; text-align: left; margin-top: 0.5rem; margin-bottom: 0.5rem; } .chevronIcon { margin-right: 0.5rem; transition: transform 0.2s; } .chevronIcon.open { transform: rotate(90deg); } .monthHeading { font-size: 0.875rem; margin: 0; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ifm-color-gray-600); opacity: 0.8; }Then update the component:
function CollapsibleMonthGroup({ year, month, monthGroupHeadingClassName, children, isDefaultOpen, }: { year: string; month: string; monthGroupHeadingClassName?: string; children: React.ReactNode; isDefaultOpen: boolean; }) { const [isOpen, setIsOpen] = useState(isDefaultOpen); + const contentId = `month-${year}-${month}`; return ( - <div role="group" style={{marginLeft: '0.5rem'}}> + <div role="group" className={styles.monthGroup}> <button onClick={() => setIsOpen(!isOpen)} - style={{...}} + className={styles.monthButton} aria-expanded={isOpen} + aria-controls={contentId} > <svg viewBox="0 0 16 16" width="12" height="12" - style={{...}} + className={`${styles.chevronIcon} ${isOpen ? styles.open : ''}`} > <path fill="currentColor" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z" /> </svg> <Heading as="h4" className={monthGroupHeadingClassName} - style={{...}} + className={styles.monthHeading} > {month} </Heading> </button> - {isOpen && <div>{children}</div>} + {isOpen && <div id={contentId}>{children}</div>} </div> ); }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
website/docusaurus.config.js(1 hunks)website/src/theme/BlogSidebar/Content/index.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
website/**
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
website/**: Update website documentation in website/ when adding features
Ensure consistency between CLI help text and website documentation
Follow the website's documentation structure and style
Keep website code in website/ and follow its architecture/style; test changes locally
Keep CLI and website documentation in sync; document new features with examples and use cases
Files:
website/src/theme/BlogSidebar/Content/index.tsxwebsite/docusaurus.config.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: Build (windows)
- GitHub Check: Build (linux)
- GitHub Check: Build (macos)
- GitHub Check: website-deploy-preview
- GitHub Check: Run pre-commit hooks
- GitHub Check: Review Dependency Licenses
- GitHub Check: Lint (golangci)
- GitHub Check: autofix
- GitHub Check: Analyze (go)
- GitHub Check: Summary
🔇 Additional comments (3)
website/src/theme/BlogSidebar/Content/index.tsx (2)
58-71: LGTM!Clean implementation with proper accessibility attributes and semantic structure.
142-190: The review comment is incorrect.Docusaurus supports
themeConfig.blog.sidebar.groupByYearwith a default value oftrue, so the grouping feature is enabled by default without requiring explicit configuration indocusaurus.config.js. The component correctly checks this option, and it will work as intended with Docusaurus's default settings.No action needed—the code is properly implemented.
Likely an incorrect or invalid review comment.
website/docusaurus.config.js (1)
188-200: No configuration changes needed.The blog configuration doesn't set
groupByYear, which is correct. TheBlogSidebarContentcomponent checks for this setting with a conditional—when undefined, it renders a flat list instead of grouping by year. This is intentional fallback behavior and works as designed. The 24 blog posts loading on a single page are a reasonable volume that won't cause meaningful performance issues.
|
CodeRabbit (@coderabbitai) please review if your comment "Fix hardcoded locale and month names for i18n compatibility" was addressed |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 3862 🏁 Script executed: Length of output: 6035 🏁 Script executed: Length of output: 12474 Andriy Knysh (@aknysh) Yes, my comment about fixing hardcoded locale and month names for i18n compatibility has been properly addressed! Here's what was fixed: ✅ Locale hardcoding (Line 34)
✅ Invalid date handling (Lines 26-29)
✅ Month sorting with hardcoded names (Lines 57-59)
The implementation follows the suggested approach with a |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
website/src/theme/BlogSidebar/Content/index.tsx (2)
86-153: Consider extracting inline styles for better maintainability.The component works well, but the extensive inline styles (lines 102-150) could make future maintenance and theming adjustments more challenging. Consider moving these to CSS modules or a separate stylesheet.
Example approach:
// In a separate CSS module file import styles from './CollapsibleMonthGroup.module.css'; // Then in the component: <div role="group" className={styles.monthGroup}> <button className={styles.monthButton} aria-expanded={isOpen} ...This would centralize styling and make it easier to maintain consistency across the theme.
155-203: Solid implementation with correct conditional rendering.The component properly handles both grouped and flat modes. The logic for determining the default open month (lines 164-172) is correct, though it could be slightly more concise using iteration patterns.
The firstMonthKey logic could be simplified to:
// Determine the most recent month (first in iteration order). const firstEntry = itemsByYearMonth.entries().next().value; const firstMonthKey = firstEntry ? `${firstEntry[0]}-${firstEntry[1].keys().next().value}` : null;But the current implementation is clear and readable, so this is purely optional.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
website/src/theme/BlogSidebar/Content/index.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
website/**
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
website/**: Update website documentation in website/ when adding features
Ensure consistency between CLI help text and website documentation
Follow the website's documentation structure and style
Keep website code in website/ and follow its architecture/style; test changes locally
Keep CLI and website documentation in sync; document new features with examples and use cases
Files:
website/src/theme/BlogSidebar/Content/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: Build (windows)
- GitHub Check: Build (linux)
- GitHub Check: Run pre-commit hooks
- GitHub Check: website-deploy-preview
- GitHub Check: autofix
- GitHub Check: Review Dependency Licenses
- GitHub Check: Lint (golangci)
- GitHub Check: Analyze (go)
- GitHub Check: Summary
🔇 Additional comments (4)
website/src/theme/BlogSidebar/Content/index.tsx (4)
1-10: Clean imports and proper attribution.The imports are well-organized and include all necessary dependencies for the component's functionality.
13-69: Previous i18n and validation concerns successfully resolved.The grouping logic now properly:
- Validates dates and handles invalid entries gracefully (lines 27-30)
- Uses 'default' locale to respect site configuration (line 34)
- Sorts by numeric month values rather than hardcoded names (lines 56-58)
All major issues from the previous review have been addressed.
71-84: Well-structured year group wrapper.Good use of semantic HTML and accessibility attributes with the
role="group"pattern.
204-204: Good use of memoization.Wrapping the component in
memohelps prevent unnecessary re-renders.
|
These changes were released in v1.197.0-test.0. |
Summary
Changed the blog configuration to display all posts on a single page instead of paginating with 10 posts per page.
What Changed
postsPerPagefrom10to'ALL'inwebsite/docusaurus.config.jsWhy This Change
Users were unable to discover older blog posts because they were hidden behind pagination. With only the first 10 posts visible by default, readers had no easy way to browse the complete changelog history.
Benefits
Testing
npm run build)🤖 Generated with Claude Code
Summary by CodeRabbit