From e0a96c87b5cb99c04b3dc76776fed60daed6ba13 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 8 Oct 2025 00:45:53 -0400 Subject: [PATCH] cleanup insert url --- public/styles/common.css | 13 +++++++++++++ src/content/git/wp.mdx | 2 +- src/pages/git/[slug].astro | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/public/styles/common.css b/public/styles/common.css index b8226af..7e57ffc 100644 --- a/public/styles/common.css +++ b/public/styles/common.css @@ -111,3 +111,16 @@ pre { 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; +} diff --git a/src/content/git/wp.mdx b/src/content/git/wp.mdx index 2e3d52e..e2818f1 100644 --- a/src/content/git/wp.mdx +++ b/src/content/git/wp.mdx @@ -3,4 +3,4 @@ title: "wp.git" date: "07/10/2025" --- -some of my wallpapers: `git clone https://git.barrettruth.com/wp.git` +some of my wallpapers diff --git a/src/pages/git/[slug].astro b/src/pages/git/[slug].astro index cc1a797..f844138 100644 --- a/src/pages/git/[slug].astro +++ b/src/pages/git/[slug].astro @@ -14,8 +14,26 @@ const entry = await getEntry("git", slug); if (!entry) return Astro.redirect("/404"); 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 {} --- + {cloneCommand && ( +
+
{cloneCommand}
+
+ )} +