--- import { getCollection } from "astro:content"; import PostItem from "./PostItem.astro"; import { getLangFromUrl } from "@/i18n"; const lang = getLangFromUrl(Astro.url); const allPosts = await getCollection("blog"); const sortedPosts = [...allPosts].sort( (a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDate).getTime(), ); const filteredPosts = sortedPosts.filter((post: any) => { const postLang = post.id.split("/")[0]; return postLang === lang; }); const latestPosts = filteredPosts.slice(0, 5); ---