organize
This commit is contained in:
parent
024226ef53
commit
81fca03582
5 changed files with 38 additions and 4 deletions
|
|
@ -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}>
|
||||
|
|
|
|||
|
|
@ -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
8
src/content/git/wp.mdx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
title: "wp"
|
||||
date: "07/10/2025"
|
||||
---
|
||||
|
||||
# wp
|
||||
|
||||
some of my wallpapers
|
||||
|
|
@ -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 },
|
||||
|
|
|
|||
21
src/pages/git/[slug].astro
Normal file
21
src/pages/git/[slug].astro
Normal 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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue