Initialize project with general functionality

This commit is contained in:
thiloho
2025-04-26 09:13:54 +02:00
commit 69be9d8ab7
42 changed files with 6368 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
---
import PageLayout from "../../layouts/PageLayout.astro";
import { getCollection } from "astro:content";
import Date from "../../components/Date.astro";
const allArticles = await getCollection("blog");
const sortedArticles = allArticles.sort((a, b) => {
return b.data.pubDate.valueOf() - a.data.pubDate.valueOf();
});
---
<PageLayout title="Blog" metaDescription="Blog">
<ul>
{
sortedArticles.map((article) => (
<li class="gap-1">
<Date date={article.data.pubDate} />
<span>&raquo;</span>
<a
class="text-blue-800 hover:no-underline"
href={`/blog/${article.id}`}
>
{article.data.title}
</a>
</li>
))
}
</ul>
</PageLayout>