28 lines
680 B
Plaintext
28 lines
680 B
Plaintext
---
|
|
export const prerender = true
|
|
|
|
import { getEntryBySlug, getCollection } from "astro:content";
|
|
import PostLayout from '$/layouts/post.astro';
|
|
import Code from '../../components/Code.astro'
|
|
|
|
export async function getStaticPaths() {
|
|
const allPosts = await getCollection('blog');
|
|
return allPosts.map(post => ({
|
|
params: {
|
|
slug: post.slug
|
|
}
|
|
}))
|
|
}
|
|
|
|
const { slug } = Astro.params
|
|
const entry = await getEntryBySlug('blog', slug!)
|
|
|
|
const { id, collection, data } = entry
|
|
const { Content } = await entry.render()
|
|
---
|
|
<PostLayout meta={{id, collection, slug }} content={data} >
|
|
<Content components={{
|
|
code: Code
|
|
}}/>
|
|
</PostLayout>
|