the horrors

This commit is contained in:
Laker Turner 2025-03-17 12:49:54 +00:00
parent 0d9be3d002
commit 4245370f61
No known key found for this signature in database
48 changed files with 2513 additions and 265 deletions

24
src/pages/blog/[id].astro Normal file
View file

@ -0,0 +1,24 @@
---
import Page from "~/layouts/Page.astro";
import { getCollection, render } from "astro:content";
// 1. Generate a new path for every collection entry
export async function getStaticPaths() {
const posts = await getCollection("blog");
return posts.map((post) => ({
params: { id: post.id },
props: { post },
}));
}
// 2. For your template, you can get the entry directly from the prop
const { post } = Astro.props;
const { Content } = await render(post);
---
<Page
title={post.data.title}
description={post.data.description}
date={post.data.date}
icon={post.data.icon}
>
<Content />
</Page>

View file

@ -0,0 +1,12 @@
---
import Page from "~/layouts/Page.astro";
import BlogPostList from "~/components/lists/BlogPostList.astro";
---
<Page
title="Post index"
description="A list of all my blog posts."
icon="fa-solid fa-blog"
>
<BlogPostList collection="blog" />
</Page>