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

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

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

<DocsLayout
  title={entry.data.title}
  description={entry.data.description}
  currentSlug={entry.id}
  headings={headings}
  editPath={`${entry.id}.md`}
>
  <Content />
</DocsLayout>
