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

export async function getStaticPaths() {
  const entries = await getCollection("glossaire");
  return entries.map((entry) => ({
    params: { slug: String(entry.id).replace(/\.(md|mdx)$/i, "") },
    props: { entry },
  }));
}

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

<EditionLayout
  title={entry.data.title}
  editionLabel="Glossaire"
  editionKey="glossaire"
  statusLabel="référentiel"
  statusKey="referentiel"
  level={1}
  version={entry.data.version}
>
  <h1>{entry.data.term}</h1>
  <p><em>{entry.data.definitionShort}</em></p>
  <Content />
</EditionLayout>