--- import Layout from '../../layouts/Layout.astro'; import { getBlogPosts, getBlogCategories } from '../../lib/blog'; const url = new URL(Astro.request.url); const category = url.searchParams.get('category') || ''; const page = Math.max(1, parseInt(url.searchParams.get('page') || '1')); const perPage = 12; const categoryMap: Record = { guides: 'Koopgidsen', deals: 'Deals', comparisons: 'Vergelijkingen', trends: 'Trends', }; const { posts, total } = await getBlogPosts({ limit: perPage, offset: (page - 1) * perPage, category: category || undefined, }); const categories = await getBlogCategories(); const totalPages = Math.ceil(total / perPage); function formatDate(d: string | null) { if (!d) return ''; return new Date(d).toLocaleDateString('nl-NL', { day: 'numeric', month: 'long', year: 'numeric' }); } ---