Skip to content

Conversation

TatsukiMengChen
Copy link

@TatsukiMengChen TatsukiMengChen commented Aug 10, 2025

Type of change

  • Bug fix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other (please describe):

Checklist

  • I have read the CONTRIBUTING document.
  • I have checked to ensure that this Pull Request is not for personal changes.
  • I have performed a self-review of my own code.
  • My changes generate no new warnings.

Related Issue

[Feature]: 添加多级分类 #580

Changes

Implemented nested category functionality to support hierarchical article classification:

  • Article categorization system upgrade: Modified the category field in article frontmatter to support multi-level category structures using / separator (e.g., A/B/C)
  • Sidebar category component refactoring:
    • Added CategoryBranch.astro component for rendering category tree structure
    • Added CategoryItem.astro component for rendering individual category items
    • Refactored Categories.astro component to support collapsible nested category display
  • Archive page functionality enhancement: Updated ArchivePanel.svelte component to support filtering and displaying articles by nested categories
  • Utility function optimization: Enhanced category processing logic in content-utils.ts to support parsing and filtering of multi-level categories

How To Test

Testing steps:

  1. Create test articles with different category levels:

    • First level: category: A
    • Second level: category: A/B
    • Third level: category: A/B/C
  2. Sidebar category component testing:

    • Visit any page and check the sidebar category component
    • Verify categories are displayed correctly in hierarchical structure
    • Test expand/collapse functionality of the category tree
  3. Archive page testing:

    • Navigate to /archive page
    • Click on different category levels
    • Verify that filtering results correctly display articles from the selected category and its subcategories
  4. Compatibility testing:

    • Verify that existing single-level category functionality still works properly
    • Confirm that old and new category formats can coexist

Screenshots

Created three test articles for functionality validation using categories A, A/B, and A/B/C:

Sidebar Category Component

771a891b93f645082782619f0c4d98b5

Archive Page Category Filtering

Filter by category A (shows articles from A and all its subcategories)

33dd007600a7f4cfad10eb9b4977ffde

Filter by category A/B (shows articles from A/B and its subcategories)

a2e0a5e2b8b799edb2f753921abf12d9

Filter by category A/B/C (shows only articles from this category)

c6599a4fc24018556fe89bc20ba443dd

Additional Notes

  • This feature is fully backward compatible and will not affect existing single-level category usage
  • Category filtering uses prefix matching mechanism - selecting a parent category will display articles from all subcategories
  • UI design maintains consistency with existing theme styles and supports responsive layout

Copy link

vercel bot commented Aug 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fuwari-yags ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 10, 2025 3:40pm

snail-tourist added a commit to snail-tourist/fuwari that referenced this pull request Aug 12, 2025
Xeonzilla pushed a commit to Xeonzilla/astro-blog that referenced this pull request Sep 23, 2025
feat: Implement nested category structure and update category components

fix: Update category filtering to support nested categories

refactor: Combine CategoryBranch and CategoryItem

style: Use btn-card style for icon

refactor: Remove unused code and comment

feat: robuster filter for ArchivePanel

Reference: [Upstream#591](saicaca/fuwari#591)
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.

1 participant