popov.link/src/pages/blog/[...slug].astro

40 lines
955 B
Plaintext
Raw Normal View History

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-06 08:21:27 +00:00
<div class="header">
2024-09-06 08:26:14 +00:00
<h1>{post.data.title}</h1>
2024-09-06 08:21:27 +00:00
<p>
<small>
Posted
2024-09-06 08:25:35 +00:00
<time datetime={post.data.pubDate.toISOString()}>{post.data.pubDate.toDateString()}</time>
&nbsp;by&nbsp;{post.data.author}&nbsp;
2024-09-06 08:21:27 +00:00
<strong>{remarkPluginFrontmatter.minutesRead}</strong>
</small>
</p>
</div>
2024-09-04 21:16:37 +00:00
<Content />
2024-09-06 08:36:02 +00:00
<Comments />
2024-09-04 21:16:37 +00:00
</Layout>