From 81fca03582bc642b57d190e4adb8557f2361108b Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 8 Oct 2025 00:02:00 -0400 Subject: [PATCH] organize --- src/components/Pseudocode.astro | 2 -- src/content/config.ts | 9 +++++++++ src/content/git/wp.mdx | 8 ++++++++ src/pages/gist/[slug].astro | 2 -- src/pages/git/[slug].astro | 21 +++++++++++++++++++++ 5 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 src/content/git/wp.mdx create mode 100644 src/pages/git/[slug].astro diff --git a/src/components/Pseudocode.astro b/src/components/Pseudocode.astro index 39d4d67..c8f8b12 100644 --- a/src/components/Pseudocode.astro +++ b/src/components/Pseudocode.astro @@ -28,8 +28,6 @@ const lines = Astro.props.code } - { console.log(lines) } -
   {lines.map((line, i) => (
     
diff --git a/src/content/config.ts b/src/content/config.ts index 81d9bdb..a55cdfd 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -21,8 +21,17 @@ const gistsCollection = defineCollection({ }), }); +const gitsCollection = defineCollection({ + type: "content", + schema: z.object({ + title: z.string(), + date: z.string().optional(), + }), +}); + export const collections = { posts: postsCollection, gists: gistsCollection, + gits: gitsCollection, }; diff --git a/src/content/git/wp.mdx b/src/content/git/wp.mdx new file mode 100644 index 0000000..97191d6 --- /dev/null +++ b/src/content/git/wp.mdx @@ -0,0 +1,8 @@ +--- +title: "wp" +date: "07/10/2025" +--- + +# wp + +some of my wallpapers diff --git a/src/pages/gist/[slug].astro b/src/pages/gist/[slug].astro index d87de02..9346c49 100644 --- a/src/pages/gist/[slug].astro +++ b/src/pages/gist/[slug].astro @@ -5,8 +5,6 @@ import PostLayout from "../../layouts/PostLayout.astro"; export async function getStaticPaths() { const gists = await getCollection("gists"); - console.log(gists) - return gists.map((gist) => ({ params: { slug: gist.slug }, props: { gist }, diff --git a/src/pages/git/[slug].astro b/src/pages/git/[slug].astro new file mode 100644 index 0000000..cc1a797 --- /dev/null +++ b/src/pages/git/[slug].astro @@ -0,0 +1,21 @@ +--- +import { getEntry } from "astro:content"; +import PostLayout from "../../layouts/PostLayout.astro"; + +export async function getStaticPaths() { + const res = await fetch("https://git.barrettruth.com/api/repositories"); + const json = res.ok ? await res.json() : { repositories: [] }; + const repos = (json.repositories || []).map((r) => r.replace(/\.git$/, "")); + return repos.map((slug) => ({ params: { slug } })); +} + +const { slug } = Astro.params; +const entry = await getEntry("git", slug); +if (!entry) return Astro.redirect("/404"); + +const { Content } = await entry.render(); +--- + + + +