1 ---
2 export const prerender = true
3 import { type CollectionEntry, getCollection } from 'astro:content'
4 import PostLayout from '@/layouts/PostLayout.astro'
5 import { render } from 'astro:content'
6
7 export async function getStaticPaths() {
8 const posts = await getCollection('posts')
9 return posts
10 .filter((post) => !post.id.startsWith('_'))
11 .map((post) => ({
12 params: { slug: post.id },
13 props: post
14 }))
15 }
16 type Props = CollectionEntry<'posts'>
17
18 const post = Astro.props
19 const { Content, remarkPluginFrontmatter } = await render(post)
20
21 const readingTime = remarkPluginFrontmatter.readingTime
22 const toc = remarkPluginFrontmatter.toc || []
23 ---
24
25 <PostLayout {...post.data} readingTime={readingTime} toc={toc}>
26 <Content />
27 </PostLayout>