39 lines
1008 B
Plaintext
39 lines
1008 B
Plaintext
---
|
|
import PageLayout from "@layouts/PageLayout.astro"
|
|
import TopLayout from "@layouts/TopLayout.astro"
|
|
import BottomLayout from "@layouts/BottomLayout.astro"
|
|
import ArticleTopLayout from "@layouts/ArticleTopLayout.astro"
|
|
import ArticleBottomLayout from "@layouts/ArticleBottomLayout.astro"
|
|
import { getBlogPostById } from "@lib/appwrite-service"
|
|
|
|
|
|
// Get the requested post
|
|
const slug = Astro.params.slug || ''
|
|
const post = await getBlogPostById(slug)
|
|
.then(blogPost => {
|
|
if (blogPost) {
|
|
return blogPost;
|
|
}
|
|
return null;
|
|
})
|
|
.catch(error => {
|
|
console.error("Error fetching blog post:", error);
|
|
return null;
|
|
})
|
|
|
|
const { title, summary } = post || { title: "Post not found", summary: "" }
|
|
---
|
|
|
|
<PageLayout title={title} description={summary}>
|
|
<TopLayout>
|
|
<div class="animate">
|
|
<ArticleTopLayout entry={post}/>
|
|
</div>
|
|
</TopLayout>
|
|
<BottomLayout>
|
|
<div class="animate">
|
|
<ArticleBottomLayout entry={post} />
|
|
</div>
|
|
</BottomLayout>
|
|
</PageLayout>
|