feat: article tags link to articles with the same tag
This commit is contained in:
parent
1b1bbae3ce
commit
aa26e7cd55
10 changed files with 309 additions and 363 deletions
|
@ -2,7 +2,7 @@
|
|||
import Layout from "@layouts/Layout.astro";
|
||||
import Prose from "@components/Prose.astro";
|
||||
import FormattedDate from "@components/FormattedDate.astro";
|
||||
import { readingTime } from "@lib/utils";
|
||||
import { readingTime, createSlug } from "@lib/utils";
|
||||
import { Icon } from "astro-icon/components";
|
||||
import RelatedArticles from "@components/RelatedArticles.astro";
|
||||
|
||||
|
@ -76,6 +76,21 @@ const listFormatter = new Intl.ListFormat("en-GB", {
|
|||
</div>
|
||||
) : null
|
||||
}
|
||||
{
|
||||
article.data.tags ? (
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<Icon name="mdi:tag" />
|
||||
{article.data.tags.map((tag: any) => (
|
||||
<a
|
||||
href={`/tags/${createSlug(tag)}`}
|
||||
class="underline hover:no-underline"
|
||||
>
|
||||
{tag}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
</div>
|
||||
<div
|
||||
class="animate-reveal mx-auto max-w-full opacity-0 [animation-delay:0.2s]"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue