---
import BlogPost from '@layouts/blogPost.astro'
import { getCollection, render } from 'astro:content'

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)
---

<BlogPost frontmatter={entry.data}>
  <Content />
</BlogPost>