Samuel Shuert | 86826b8 | 2024-04-27 16:14:20 -0400 | [diff] [blame] | 1 | --- |
| 2 | import { type CollectionEntry, getCollection } from 'astro:content'; |
| 3 | import BlogPost from '../../layouts/BlogPost.astro'; |
| 4 | |
| 5 | export async function getStaticPaths() { |
Samuel Shuert | 21af95a | 2024-04-30 17:49:11 -0400 | [diff] [blame^] | 6 | const posts = await getCollection('post'); |
Samuel Shuert | 3963283 | 2024-04-29 20:54:19 -0400 | [diff] [blame] | 7 | return posts.map((post: { slug: any; }) => ({ |
Samuel Shuert | 86826b8 | 2024-04-27 16:14:20 -0400 | [diff] [blame] | 8 | params: { slug: post.slug }, |
| 9 | props: post, |
| 10 | })); |
| 11 | } |
Samuel Shuert | 21af95a | 2024-04-30 17:49:11 -0400 | [diff] [blame^] | 12 | type Props = CollectionEntry<'post'>; |
Samuel Shuert | 86826b8 | 2024-04-27 16:14:20 -0400 | [diff] [blame] | 13 | |
| 14 | const post = Astro.props; |
| 15 | const { Content } = await post.render(); |
| 16 | --- |
| 17 | |
| 18 | <BlogPost {...post.data}> |
| 19 | <Content /> |
| 20 | </BlogPost> |