summaryrefslogtreecommitdiff
path: root/src/components/blog/webmentions/index.astro
blob: 80376f0d5016cbaae8fca3a3dcec0b243d10c7c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
import { t } from "@/i18n/translations";
import { getWebmentionsForUrl } from "@/utils/webmentions";
import Comments from "./Comments.astro";
import Likes from "./Likes.astro";

interface Props {
	language?: string | undefined;
}

const { language } = Astro.props;
const url = new URL(Astro.url.pathname, Astro.site);

const webMentions = await getWebmentionsForUrl(`${url}`);

// Return if no webmentions
if (!webMentions.length) return;
---

<hr class="border-solid" />
<h2 class="mb-8 before:hidden">{t(language, "webmentionsTitle")}</h2>
<div class="space-y-10">
	<Likes mentions={webMentions} language={language} />
	<Comments mentions={webMentions} language={language} />
</div>
<p class="mt-8">
	{t(language, "responsesPoweredBy")}{" "}
	<a href="https://webmention.io" rel="noreferrer" target="_blank">Webmentions</a>
</p>