summaryrefslogtreecommitdiffstats
path: root/indieweb-micro/themes/MinIndie/layouts/partials/webmentions.html
diff options
context:
space:
mode:
Diffstat (limited to 'indieweb-micro/themes/MinIndie/layouts/partials/webmentions.html')
-rw-r--r--indieweb-micro/themes/MinIndie/layouts/partials/webmentions.html21
1 files changed, 19 insertions, 2 deletions
diff --git a/indieweb-micro/themes/MinIndie/layouts/partials/webmentions.html b/indieweb-micro/themes/MinIndie/layouts/partials/webmentions.html
index 56a12d7..ff572c7 100644
--- a/indieweb-micro/themes/MinIndie/layouts/partials/webmentions.html
+++ b/indieweb-micro/themes/MinIndie/layouts/partials/webmentions.html
@@ -92,6 +92,7 @@
</style>
<script>
+const PAGE_URL = "{{ .Permalink }}";
async function loadMentions() {
const url =
"https://webmention.io/api/mentions.jf2?domain=micro.pinapelz.moe&token=hdjQAqlZwgJmSuPSiU8h8w";
@@ -102,12 +103,28 @@ async function loadMentions() {
const container = document.getElementById("mentions");
container.innerHTML = "";
- if (!data.children || data.children.length === 0) {
+ const mentions = data.children.filter(m => {
+ const t = m["wm-target"];
+ const inReply = m["in-reply-to"];
+ const likeOf = m["like-of"];
+ const repostOf = m["repost-of"];
+ const mentionOf = m["mention-of"];
+
+ return (
+ t === PAGE_URL ||
+ inReply === PAGE_URL ||
+ likeOf === PAGE_URL ||
+ repostOf === PAGE_URL ||
+ mentionOf === PAGE_URL
+ );
+ });
+
+ if (!mentions.length) {
container.innerHTML = "<p>No webmentions yet.</p>";
return;
}
- data.children.forEach(m => {
+ mentions.forEach(m => {
const div = document.createElement("div");
div.className = "wm";
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage