Files
astroplate/src/pages/blog/[single].astro
T
2023-12-09 11:14:43 +06:00

31 lines
639 B
Plaintext
Executable File

---
import Base from "@/layouts/Base.astro";
import PostSingle from "@/layouts/PostSingle.astro";
import { getSinglePage } from "@/lib/contentParser.astro";
export async function getStaticPaths() {
const BLOG_FOLDER = "blog";
const posts = await getSinglePage(BLOG_FOLDER);
const paths = posts.map((post) => ({
params: {
single: post.slug,
},
props: { post },
}));
return paths;
}
const { post } = Astro.props;
const { title, meta_title, description, image } = post.data;
---
<Base
title={title}
meta_title={meta_title}
description={description}
image={image}
>
<PostSingle post={post} />
</Base>