Skip to content

Commit 6c76395

Browse files
fix: update blog routing to use post slugs instead of IDs; adjust rendering method for blog posts
1 parent 777124a commit 6c76395

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/pages/blog/[...slug].astro

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
---
22
import { type CollectionEntry, getCollection } from 'astro:content';
33
import BlogPost from '../../layouts/BlogPost.astro';
4-
//import { render } from 'astro:content';
54
65
export async function getStaticPaths() {
76
const posts = await getCollection('blog');
87
return posts.map((post) => ({
9-
params: { slug: post.id },
8+
params: { slug: post.slug },
109
props: post,
1110
}));
1211
}
1312
type Props = CollectionEntry<'blog'>;
1413
1514
const post = Astro.props;
16-
const { Content } = await render(post);
15+
const { Content } = await post.render();
1716
---
1817

1918
<BlogPost {...post.data}>
2019
<Content />
21-
</BlogPost>
20+
</BlogPost>

0 commit comments

Comments
 (0)