chore: update to latest astro ink version
This commit is contained in:
27
src/pages/blog/[slug].astro
Normal file
27
src/pages/blog/[slug].astro
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
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>
|
||||
Reference in New Issue
Block a user