--- import BaseLayout from "../../layouts/BaseLayout.astro"; import { getCollection } from "astro:content"; export async function getStaticPaths() { const posts = await getCollection("posts"); const categories = Array.from(new Set(posts.map((p) => p.id.split("/")[0]))); return categories.map((category) => ({ params: { category } })); } const category = Astro.params.category; const title = "Barrett Ruth"; const allPosts = await getCollection("posts"); const postsByCategory = allPosts.reduce((acc, post) => { const c = post.id.split("/")[0]; (acc[c] ||= []).push(post); return acc; }, {}); Object.keys(postsByCategory).forEach((c) => { postsByCategory[c].sort((a, b) => { const parseEuroDate = (dateStr) => { if (!dateStr) return new Date(0); const [day, month, year] = (dateStr || "").split("/"); return new Date(year, month - 1, day); }; return parseEuroDate(b.data.date) - parseEuroDate(a.data.date); }); }); ---