This commit is contained in:
Barrett Ruth 2025-10-08 19:04:25 -04:00
parent 846bce9480
commit 60aea94006
32 changed files with 328 additions and 278 deletions

View file

@ -17,22 +17,27 @@ const { Content } = await entry.render();
const repoName = `${slug}.git`;
let cloneCommand = "";
try {
const res = await fetch("https://git.barrettruth.com/api/repositories");
const json = res.ok ? await res.json() : { repositories: [] };
const exists = json.repositories?.includes(repoName);
if (exists) {
if (exists)
cloneCommand = `git clone https://git.barrettruth.com/${repoName}`;
}
} catch {}
const pageTitle = `git/${entry.data.title ?? slug}`;
---
<GitLayout frontmatter={entry.data} post={entry}>
{cloneCommand && (
<div class="clone-line">
<code><span class="prompt">&gt;&nbsp;</span>{cloneCommand}</code>
</div>
)}
<Fragment slot="head">
<title>{pageTitle}</title>
</Fragment>
{
cloneCommand && (
<div class="clone-line">
<code>&gt; {cloneCommand}</code>
</div>
)
}
<Content />
</GitLayout>