--- export const prerender = true import { getCollection } from 'astro:content' import Layout from '@layouts/Layout.astro' import PostPreview from '@components/PostPreview.astro' const posts = await getCollection('blog') --- { posts .sort((a, b) => Date.parse(b.data.pubDate) - Date.parse(a.data.pubDate)) .slice(0, 5) .map((post) => ) } { posts.length < 5 ? null : ( ) }