2024-12-23 21:18:55 +00:00
|
|
|
---
|
|
|
|
import Layout from "@layouts/Layout.astro";
|
|
|
|
import Prose from "@components/Prose.astro";
|
|
|
|
import FormattedDate from "@components/FormattedDate.astro";
|
|
|
|
import { readingTime } from "@lib/utils";
|
|
|
|
import { Icon } from "astro-icon/components";
|
2024-12-26 15:02:43 +00:00
|
|
|
import RelatedArticles from "@components/RelatedArticles.astro";
|
2024-12-23 21:18:55 +00:00
|
|
|
|
|
|
|
const { article, isPost = false } = Astro.props;
|
|
|
|
const { Content } = await article.render();
|
|
|
|
|
|
|
|
let datesMatch = false;
|
|
|
|
if (article.data.date.getTime() == article.data.updated?.getTime()) {
|
|
|
|
datesMatch = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
const listFormatter = new Intl.ListFormat("en-GB", {
|
|
|
|
style: "long",
|
|
|
|
type: "conjunction",
|
|
|
|
});
|
|
|
|
---
|
|
|
|
|
|
|
|
<Layout
|
|
|
|
title={article.data.title}
|
|
|
|
description={article.data.description}
|
|
|
|
image={article.data.image.url.src}
|
|
|
|
date={article.data.date}
|
|
|
|
updated={article.data.updated}
|
|
|
|
tags={article.data.tags}
|
|
|
|
>
|
2025-02-13 18:55:50 +00:00
|
|
|
<h1
|
|
|
|
class="animate-reveal text-start text-3xl font-semibold break-words opacity-0"
|
|
|
|
>
|
|
|
|
<span class="text-secondary">{article.data.title}</span><span
|
|
|
|
class="text-tertiary ml-2">{article.data.description}</span
|
2024-12-23 21:18:55 +00:00
|
|
|
>
|
2025-02-13 18:55:50 +00:00
|
|
|
</h1>
|
|
|
|
<div
|
|
|
|
class="animate-reveal text-tertiary flex flex-row flex-wrap items-start gap-2 opacity-0 [animation-delay:0.1s]"
|
|
|
|
>
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
<Icon name="mdi:calendar" />
|
|
|
|
{
|
|
|
|
datesMatch ? (
|
|
|
|
<p title="Date">
|
|
|
|
<FormattedDate date={article.data.date} />
|
|
|
|
</p>
|
|
|
|
) : (
|
|
|
|
<>
|
2024-12-28 16:19:26 +00:00
|
|
|
<p title="Date">
|
|
|
|
<FormattedDate date={article.data.date} />
|
|
|
|
</p>
|
2025-02-13 18:55:50 +00:00
|
|
|
<Icon name="mdi:trending-up" />
|
|
|
|
<p title="Updated">
|
|
|
|
<FormattedDate date={article.data.updated} />
|
2024-12-23 21:18:55 +00:00
|
|
|
</p>
|
2025-02-13 18:55:50 +00:00
|
|
|
</>
|
|
|
|
)
|
2024-12-23 21:18:55 +00:00
|
|
|
}
|
|
|
|
</div>
|
2025-02-13 18:55:50 +00:00
|
|
|
{
|
|
|
|
isPost ? (
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
<Icon name="mdi:timer" />
|
|
|
|
<p title="Word count">{readingTime(article.body)}</p>
|
|
|
|
</div>
|
|
|
|
) : null
|
|
|
|
}
|
|
|
|
{
|
|
|
|
article.data.extraAuthors ? (
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
<Icon name="mdi:account-plus" />
|
|
|
|
<p title="Collaborators">
|
|
|
|
{listFormatter.format(article.data.extraAuthors)}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
) : null
|
|
|
|
}
|
2024-12-23 21:18:55 +00:00
|
|
|
</div>
|
2025-02-13 19:02:35 +00:00
|
|
|
<div
|
|
|
|
class="animate-reveal mx-auto max-w-full opacity-0 [animation-delay:0.2s]"
|
|
|
|
>
|
2024-12-23 21:18:55 +00:00
|
|
|
<Prose>
|
|
|
|
<Content />
|
|
|
|
</Prose>
|
|
|
|
</div>
|
2024-12-26 15:02:43 +00:00
|
|
|
<RelatedArticles entry={article} />
|
2024-12-23 21:18:55 +00:00
|
|
|
</Layout>
|