feat: some shit

This commit is contained in:
2024-04-03 14:27:48 +02:00
parent d4128840b9
commit 93baa3b6b0
67 changed files with 2513 additions and 703 deletions

View File

@ -2,6 +2,8 @@
import { getCollection } from "astro:content";
const pages = await getCollection("blog");
import Layout from "@layouts/Layout.astro";
import HeroCard from "@components/HeroCard.astro";
import SmallCard from "@components/SmallCard.astro";
import { getLocale } from "astro-i18n-aut";
import { filterCollection } from "@i18n/utils";
@ -9,17 +11,29 @@ import { filterCollection } from "@i18n/utils";
const locale = getLocale(Astro.url);
const posts = filterCollection(pages, locale);
const featuredPosts = await Promise.all(
posts.slice(0, 3).map(async (post) => {
if (!post.data.headerImg) {
return post;
}
const { default: image } = await import(
`../../content/blog/${post.slug.split("/")[0]}/${post.data.headerImg}`
);
return {
...post,
image,
};
}),
);
const otherPosts = posts.slice(3);
---
<Layout title="Dude">
<hr />
{
posts.map((post) => (
<>
<a href={"blog/" + post.slug.split("/")[0]}>{post.data.title}</a>
<br />
</>
))
}
<hr />
{featuredPosts.map((post) => <HeroCard post={post} />)}
<div class="grid grid-cols-2 gap-4 mt-4">
{otherPosts.map((post) => <SmallCard post={post} />)}
</div>
</Layout>