2023-05-13 14:38:56 +00:00
|
|
|
---
|
2023-05-15 14:52:29 +00:00
|
|
|
import Layout from "../layouts/Layout.astro";
|
2023-05-15 15:38:17 +00:00
|
|
|
import { getPosts } from "../utils/payload";
|
2023-05-13 14:38:56 +00:00
|
|
|
|
2023-05-15 15:38:17 +00:00
|
|
|
const posts = await getPosts();
|
2023-05-13 14:38:56 +00:00
|
|
|
---
|
|
|
|
|
2023-05-15 14:52:29 +00:00
|
|
|
<Layout title="Welcome to Astroad">
|
|
|
|
<main class="flex flex-col items-center py-10 gap-5">
|
|
|
|
<h1>This is Astroad</h1>
|
|
|
|
{
|
|
|
|
posts ? (
|
|
|
|
posts.reverse().map((post) => (
|
|
|
|
<a href={`/posts/${post.id}`}>
|
|
|
|
<article class="text-teal-950 bg-yellow-100 px-5 py-3 rounded-md shadow-md w-64 text-center">
|
|
|
|
<h2>{post.title}</h2>
|
|
|
|
<p>{new Date(post.updatedAt).toLocaleDateString("de-DE")}</p>
|
|
|
|
</article>
|
|
|
|
</a>
|
|
|
|
))
|
|
|
|
) : (
|
|
|
|
<p>No posts...</p>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
</main>
|
2023-05-13 14:38:56 +00:00
|
|
|
</Layout>
|