--- import { getCollection } from "astro:content"; import Layout from "../../layouts/Layout.astro"; import NoteNavSidebar from "../../components/NoteNavSidebar.astro"; import { getCategory } from "../../utils/notes"; import { List } from "@lucide/astro"; export async function getStaticPaths() { const notes = await getCollection("notes"); const folderCategories = [ ...new Set( notes.filter((n) => n.id.includes("/")).map((n) => getCategory(n)), ), ]; return folderCategories.map((category) => { const allNotes = notes.sort((a, b) => a.data.title.localeCompare(b.data.title), ); const categories = [...new Set(notes.map(getCategory))].sort(); return { params: { category }, props: { category, categoryNotes: notes .filter((n) => getCategory(n) === category) .sort((a, b) => a.data.title.localeCompare(b.data.title)), allNotes, categories, }, }; }); } const { category, categoryNotes, allNotes, categories } = Astro.props; if (!categoryNotes) { return new Response(null, { status: 404, statusText: "Not found" }); } ---

/{ category }

{categoryNotes.length} note{ categoryNotes.length !== 1 ? "s" : "" }