0
mirror of https://github.com/valentineus/popov.link.git synced 2025-08-13 09:56:39 +03:00
Files
popov.link/src/components/PostElement.astro
Valentin Popov 17f9a467d7 refactor: update blog post date handling and schema
- Replaced `pubDate` with `datePublished` in blog post components for consistency.
- Updated sorting logic in blog sections to use `datePublished`.
- Enhanced blog post schema to include `dateModified` for better structured data representation.
- Adjusted various blog markdown files to reflect the new date fields.
2025-06-14 11:25:17 +00:00

41 lines
840 B
Plaintext

---
import { type CollectionEntry } from "astro:content";
import dayjs from "dayjs";
type Props = {
readonly post: CollectionEntry<"blog">;
};
const { post } = Astro.props;
const { remarkPluginFrontmatter } = await post.render();
const formattedDate = dayjs(post.data.datePublished.toString()).format("MMMM DD, YYYY");
const datePublished = post.data.datePublished.toISOString();
---
<style lang="scss">
@use "../scss/variables" as *;
a {
color: $colorText;
}
small {
font-size: $fontSizeBase * 0.75;
opacity: 0.5;
}
</style>
<li>
<article>
<a href={`/blog/${post.slug}`} lang={post.data.lang}>{post.data.title}</a>
<div>
<small>
<time datetime={datePublished} lang="en">{formattedDate}</time>
<span>•</span>
<span>{remarkPluginFrontmatter.minutesRead}</span>
</small>
</div>
</article>
</li>