update astro to v5

This commit is contained in:
2024-12-03 19:18:12 -07:00
parent 57df46dc07
commit 8a99507c2a
6 changed files with 760 additions and 1671 deletions

View File

@@ -1,18 +1,19 @@
---
import { type CollectionEntry, getCollection } from 'astro:content';
import BlogPost from '../../layouts/BlogPost.astro';
import {render} from 'astro:content';
export async function getStaticPaths() {
const posts = await getCollection('blog');
return posts.map((post) => ({
params: { slug: post.slug },
params: { slug: post.id },
props: post,
}));
}
type Props = CollectionEntry<'blog'>;
const post = Astro.props;
const { Content } = await post.render();
const { Content } = await render(post);
---
<BlogPost {...post.data}>

View File

@@ -94,7 +94,7 @@ const posts = (await getCollection("blog")).sort((a, b) =>
{
posts.map((post) => (
<li>
<a href={`/blog/${post.slug}/`}>
<a href={`/blog/${post.id}/`}>
{post.data.heroImage &&
<Image
width={720}

View File

@@ -10,7 +10,7 @@ export async function GET(context) {
site: context.site,
items: posts.map((post) => ({
...post.data,
link: `/blog/${post.slug}/`,
link: `/blog/${post.id}/`,
})),
});
}