---
import { getCollection } from "astro:content";
import PostLayout from "../../layouts/PostLayout.astro";

export async function getStaticPaths() {
  const repos = await getCollection("git");
  return repos.map((repo) => ({
    params: { slug: repo.slug },
    props: { repo },
  }));
}

const { repo } = Astro.props;
const { Content } = await repo.render();
const cloneCommand = `git clone https://git.barrettruth.com/${repo.slug}.git`;
---

<PostLayout frontmatter={repo.data} post={repo}>
  <Fragment slot="head">
    <link rel="stylesheet" href="/styles/git.css" />
  </Fragment>

  <div class="clone-line">
    <code><span class="prompt">&gt;&nbsp;</span>{cloneCommand}</code>
  </div>

  <Content />
</PostLayout>
