---
import Post from "@layouts/Post.astro";
import { shouldShowPost } from "@lib/helpers";
import { getCollection } from "astro:content";

export async function getStaticPaths() {
  const posts = await getCollection("blog");
  return posts
    .filter(shouldShowPost)
    .map((entry) => {
      return {
        params: { slug: entry.slug },
        props: { entry },
      };
    });
}

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

<Post post={entry}>
  <Content />
</Post>
