cleanup insert url
This commit is contained in:
parent
efeb921a1b
commit
e0a96c87b5
3 changed files with 32 additions and 1 deletions
|
|
@ -111,3 +111,16 @@ pre {
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.clone-banner {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-family: 'Apercu Mono', monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clone-banner code {
|
||||||
|
font-size: 0.95em;
|
||||||
|
user-select: all;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,4 @@ title: "wp.git"
|
||||||
date: "07/10/2025"
|
date: "07/10/2025"
|
||||||
---
|
---
|
||||||
|
|
||||||
some of my wallpapers: `git clone https://git.barrettruth.com/wp.git`
|
some of my wallpapers
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,26 @@ const entry = await getEntry("git", slug);
|
||||||
if (!entry) return Astro.redirect("/404");
|
if (!entry) return Astro.redirect("/404");
|
||||||
|
|
||||||
const { Content } = await entry.render();
|
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) {
|
||||||
|
cloneCommand = `git clone https://git.barrettruth.com/${repoName}`;
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
---
|
---
|
||||||
|
|
||||||
<PostLayout frontmatter={entry.data} post={entry}>
|
<PostLayout frontmatter={entry.data} post={entry}>
|
||||||
|
{cloneCommand && (
|
||||||
|
<div class="clone-banner">
|
||||||
|
<pre><code class="language-bash">{cloneCommand}</code></pre>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<Content />
|
<Content />
|
||||||
</PostLayout>
|
</PostLayout>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue