--- import type { CollectionEntry } from 'astro:content'; import Icon from './Icon.astro'; export interface Props { currentDocId: string; currentCategory: string | null; allDocs: CollectionEntry<'docs'>[]; } const { currentDocId, currentCategory, allDocs } = Astro.props; // Filter docs by category // If current page has no category (or "General"), show all docs // Otherwise, show only docs matching the current category let filteredDocs: CollectionEntry<'docs'>[] = []; if (!currentCategory || currentCategory.trim() === '' || currentCategory === 'General') { // Show all docs if no category filteredDocs = allDocs; } else { // Filter by category - handle "Unsorted" specially if (currentCategory === 'Unsorted') { filteredDocs = allDocs.filter(doc => !doc.data.category || doc.data.category.trim() === '' || doc.data.category === 'General' ); } else { filteredDocs = allDocs.filter(doc => doc.data.category && doc.data.category.trim() !== '' && doc.data.category !== 'General' && doc.data.category === currentCategory ); } } // Sort by order, then by title filteredDocs.sort((a, b) => { if (a.data.order !== b.data.order) { return a.data.order - b.data.order; } return a.data.title.localeCompare(b.data.title); }); // Determine sidebar header text const sidebarHeader = currentCategory && currentCategory !== 'General' ? currentCategory : 'Documentation'; ---