---
import Layout from "../../layouts/Layout.astro";
import { getCollection } from "astro:content";

const posts = await getCollection("blog");
---

<Layout title="Home">
  <h1>Blog</h1>
  <p>
    Random thoughts on technology, photography and sports.
    <ul>
      {
        posts.map((post) => (
          <li>
            <a href={`/blog/${post.id}`}>{post.data.title}</a>
          </li>
        ))
      }
    </ul>
  </p>
</Layout>
