feat: ai
This commit is contained in:
@@ -1,9 +1,24 @@
|
||||
---
|
||||
import Layout from "@/layouts/Layout.astro";
|
||||
import { getCollection, getEntry } from 'astro:content';
|
||||
import PostLayout from '@/layouts/PostLayout.astro';
|
||||
import { getReadingTime } from '@/utils/reading-time';
|
||||
|
||||
const { slug } = Astro.params;
|
||||
|
||||
if (!slug) {
|
||||
return Astro.redirect('/404');
|
||||
}
|
||||
|
||||
const post = await getEntry('posts', slug);
|
||||
|
||||
if (!post || post.data.draft) {
|
||||
return Astro.redirect('/404');
|
||||
}
|
||||
|
||||
const { Content } = await post.render();
|
||||
const readingTime = getReadingTime(post.body);
|
||||
---
|
||||
|
||||
<Layout>
|
||||
<h1>Post Slug: {slug}</h1>
|
||||
</Layout>
|
||||
<PostLayout post={post} readingTime={readingTime}>
|
||||
<Content />
|
||||
</PostLayout>
|
||||
|
||||
Reference in New Issue
Block a user