2026-03-24 17:33:01 +00:00
|
|
|
---
|
2026-03-24 18:01:45 +00:00
|
|
|
import { getCollection } from "astro:content";
|
2026-03-24 17:33:01 +00:00
|
|
|
import PostItem from "./PostItem.astro";
|
2026-03-24 22:50:33 +00:00
|
|
|
import { getLangFromUrl, getTranslations, type Lang } from "@/i18n";
|
2026-03-24 17:33:01 +00:00
|
|
|
|
2026-03-24 22:50:33 +00:00
|
|
|
const lang = getLangFromUrl(Astro.url);
|
|
|
|
|
const t = getTranslations(lang);
|
2026-03-24 18:01:45 +00:00
|
|
|
const allPosts = await getCollection("blog");
|
2026-03-24 17:33:01 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
<ul>
|
2026-03-24 18:01:45 +00:00
|
|
|
{
|
|
|
|
|
allPosts.map((post: any) => {
|
|
|
|
|
const formattedDate = new Date(post.data.pubDate)
|
|
|
|
|
.toISOString()
|
|
|
|
|
.split("T")[0];
|
2026-03-24 17:33:01 +00:00
|
|
|
|
2026-03-24 18:01:45 +00:00
|
|
|
return (
|
|
|
|
|
<PostItem
|
2026-03-24 22:50:33 +00:00
|
|
|
url={`/${lang}/posts/${post.id}/`}
|
2026-03-24 18:01:45 +00:00
|
|
|
title={post.data.title}
|
2026-03-25 08:12:49 +00:00
|
|
|
description={post.data.description}
|
2026-03-24 18:01:45 +00:00
|
|
|
date={formattedDate}
|
2026-03-24 23:40:19 +00:00
|
|
|
img={post.data.image.url}
|
2026-03-24 18:01:45 +00:00
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
}
|
2026-03-24 17:33:01 +00:00
|
|
|
</ul>
|
2026-03-24 23:40:19 +00:00
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
ul {
|
|
|
|
|
margin: 0;
|
|
|
|
|
padding-left: 0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|