aboutsummaryrefslogtreecommitdiff
path: root/src/pages/blog
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-10-03 02:04:27 +0300
committerValentin Popov <valentin@popov.link>2024-10-03 02:04:27 +0300
commit2b5302587645dcab7c012c550989b7a8e9bee72b (patch)
treed0de8fc07cb6d0ec1c81657dcc9f0880a97c4d8b /src/pages/blog
parentd4eab1ff131c9342213f2dcc9b3c6383c7de41dd (diff)
downloadpopov.link-2b5302587645dcab7c012c550989b7a8e9bee72b.tar.xz
popov.link-2b5302587645dcab7c012c550989b7a8e9bee72b.zip
Update blog post metadata and styles
Diffstat (limited to 'src/pages/blog')
-rw-r--r--src/pages/blog/[...slug].astro32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro
index bcd5eed..63d2c98 100644
--- a/src/pages/blog/[...slug].astro
+++ b/src/pages/blog/[...slug].astro
@@ -2,11 +2,14 @@
import { type CollectionEntry, getCollection } from "astro:content";
import Comments from "../../components/Comments.astro";
import Layout from "../../layouts/BaseLayout.astro";
+import dayjs from "dayjs";
type Props = CollectionEntry<"blog">;
export async function getStaticPaths() {
- const posts = await getCollection("blog");
+ const posts = await getCollection("blog", ({ data }) => {
+ return data.draft !== true;
+ });
return posts.map((post) => ({
params: { slug: post.slug },
@@ -15,34 +18,31 @@ export async function getStaticPaths() {
}
const post = Astro.props;
-const { Content, remarkPluginFrontmatter } = await post.render();
+const { Content } = await post.render();
+const formattedDate = dayjs(post.data.pubDate.toString()).format("MMMM DD, YYYY");
---
-<style>
- .header {
- text-align: center;
- }
-</style>
-
<Layout description={post.data.description} title={post.data.title}>
<article>
- <section class="header">
+ <section>
<h1>{post.data.title}</h1>
+ </section>
+
+ <section>
+ <Content />
+ </section>
+
+ <section>
<p>
<small>
Posted
- <time datetime={post.data.pubDate.toISOString()}>{post.data.pubDate.toDateString()}</time>
- &nbsp;by&nbsp;{post.data.author}&nbsp;‐
- <strong>{remarkPluginFrontmatter.minutesRead}</strong>
+ <time datetime={post.data.pubDate.toISOString()}>{formattedDate}</time>
+ by&nbsp;{post.data.author}
</small>
</p>
</section>
<section>
- <Content />
- </section>
-
- <section>
<Comments />
</section>
</article>