---
import { getCollection, render } from "astro:content";
import BlogLayout from "../../layouts/BlogLayout.astro";

export async function getStaticPaths() {
  const blogEntries = await getCollection("blog");

  return blogEntries.map((entry) => ({
    params: { slug: entry.id },
    props: { entry },
  }));
}

const { entry } = Astro.props;
const { Content } = await render(entry);
---

<BlogLayout
  title={entry.data.title}
  description={entry.data.description}
  publishDate={entry.data.publishDate}
  updatedDate={entry.data.updatedDate}
  image={entry.data.image}
  tags={entry.data.tags}
>
  <Content />
</BlogLayout>
