blog/src/pages/posts/[...slug].astro

34 lines
884 B
Text
Raw Normal View History

2023-08-31 03:47:22 +00:00
---
2023-08-31 08:07:03 +00:00
import "../../styles/post.scss";
2023-08-31 03:47:22 +00:00
import BaseLayout from "../../layouts/BaseLayout.astro";
import { type CollectionEntry, getCollection } from "astro:content";
2023-08-31 08:07:03 +00:00
import Timestamp from "../../components/Timestamp.astro";
2023-08-31 03:47:22 +00:00
// import BlogPost from "../../layouts/BlogPost.astro";
export async function getStaticPaths() {
const posts = await getCollection("posts");
return posts.map((post) => ({
params: { slug: post.slug },
props: post,
}));
}
type Props = CollectionEntry<"posts">;
const post = Astro.props;
2023-08-31 08:07:03 +00:00
const { Content, remarkPluginFrontmatter } = await post.render();
2023-08-31 03:47:22 +00:00
---
<BaseLayout>
2023-08-31 08:07:03 +00:00
<h1 class="post-title">{post.data.title}</h1>
<small class="post-meta">
Posted on <Timestamp timestamp={post.data.date} />
- {remarkPluginFrontmatter.minutesRead}
</small>
2023-08-31 03:47:22 +00:00
<!-- <BlogPost {...post.data}> -->
<Content />
<!-- </BlogPost> -->
</BaseLayout>