2024-09-04 21:16:37 +00:00
|
|
|
|
---
|
|
|
|
|
import { type CollectionEntry, getCollection } from "astro:content";
|
2024-09-06 08:36:02 +00:00
|
|
|
|
import Comments from "../../components/Comments.astro";
|
2024-09-06 08:21:27 +00:00
|
|
|
|
import Layout from "../../layouts/PageLayout.astro";
|
2024-09-04 21:16:37 +00:00
|
|
|
|
|
|
|
|
|
export async function getStaticPaths() {
|
|
|
|
|
const posts = await getCollection("blog");
|
|
|
|
|
return posts.map((post) => ({
|
|
|
|
|
params: { slug: post.slug },
|
|
|
|
|
props: post,
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
type Props = CollectionEntry<"blog">;
|
|
|
|
|
|
|
|
|
|
const post = Astro.props;
|
2024-09-06 08:21:27 +00:00
|
|
|
|
const { Content, remarkPluginFrontmatter } = await post.render();
|
2024-09-04 21:16:37 +00:00
|
|
|
|
---
|
|
|
|
|
|
2024-09-06 08:21:27 +00:00
|
|
|
|
<style>
|
|
|
|
|
.header {
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
2024-09-11 22:03:55 +00:00
|
|
|
|
<Layout title={post.data.title} description={post.data.description}>
|
2024-09-12 13:11:16 +00:00
|
|
|
|
<article>
|
|
|
|
|
<section class="header">
|
|
|
|
|
<h1>{post.data.title}</h1>
|
|
|
|
|
<p>
|
|
|
|
|
<small>
|
|
|
|
|
Posted
|
|
|
|
|
<time datetime={post.data.pubDate.toISOString()}>{post.data.pubDate.toDateString()}</time>
|
|
|
|
|
by {post.data.author} ‐
|
|
|
|
|
<strong>{remarkPluginFrontmatter.minutesRead}</strong>
|
|
|
|
|
</small>
|
|
|
|
|
</p>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
|
<Content />
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
|
<Comments />
|
|
|
|
|
</section>
|
|
|
|
|
</article>
|
2024-09-04 21:16:37 +00:00
|
|
|
|
</Layout>
|