This commit is contained in:
Barrett Ruth 2025-10-08 00:02:00 -04:00
parent 024226ef53
commit 81fca03582
5 changed files with 38 additions and 4 deletions

View file

@ -28,8 +28,6 @@ const lines = Astro.props.code
}
</style>
{ console.log(lines) }
<pre class="pseudocode-block">
{lines.map((line, i) => (
<div class="pseudocode-line" key={i}>

View file

@ -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,
};

8
src/content/git/wp.mdx Normal file
View file

@ -0,0 +1,8 @@
---
title: "wp"
date: "07/10/2025"
---
# wp
some of my wallpapers

View file

@ -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 },

View file

@ -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();
---
<PostLayout frontmatter={entry.data} post={entry}>
<Content />
</PostLayout>