mirror of
https://github.com/KazooTTT/kazoottt-blog.git
synced 2025-06-22 18:21:33 +08:00
28 lines
679 B
Plaintext
28 lines
679 B
Plaintext
---
|
|
export const prerender = true
|
|
|
|
import type { GetStaticPaths, InferGetStaticPropsType } from 'astro'
|
|
|
|
import PostLayout from '@/layouts/BlogPost.astro'
|
|
import { getAllPosts } from '@/utils'
|
|
import GiscusComment from '@/components/GiscusComment'
|
|
|
|
export const getStaticPaths = (async () => {
|
|
const blogEntries = await getAllPosts()
|
|
return blogEntries.map((entry) => ({
|
|
params: { slug: entry.slug },
|
|
props: { entry }
|
|
}))
|
|
}) satisfies GetStaticPaths
|
|
|
|
type Props = InferGetStaticPropsType<typeof getStaticPaths>
|
|
|
|
const { entry } = Astro.props
|
|
const { Content } = await entry.render()
|
|
---
|
|
|
|
<PostLayout post={entry}>
|
|
<Content />
|
|
<GiscusComment client:load />
|
|
</PostLayout>
|