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

export async function getStaticPaths() {
  const allDocs = await getCollection('docs');
  // Only include docs with frontmatter title (canonical docs)
  const docs = allDocs.filter((entry) => entry.data.title);
  return docs.map((entry) => ({
    params: { slug: entry.id },
    props: { entry },
  }));
}

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

<DocsLayout title={entry.data.title ?? entry.id} description={entry.data.description}>
  <article class="prose">
    <Content />
  </article>
</DocsLayout>
