---
export const prerender = true

import type { GetStaticPaths, InferGetStaticPropsType } from 'astro'

import PostLayout from '@/layouts/BlogPost.astro'
import { getallDiaries } from 'src/utils'

export const getStaticPaths = (async () => {
	const blogEntries = await getallDiaries()
	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} simple={true} backHref='/diary'>
	<Content />
</PostLayout>
