diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-12-02 01:23:35 -0800 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-12-02 01:29:53 -0800 |
| commit | 747e44b5462e8cbedbabfd287e4d41318ada31a8 (patch) | |
| tree | 4bd200aa069a8301df7b6cd2d678ae7c4fbdc74e /indieweb-micro/themes/MinIndie/layouts/partials/webmentions.html | |
| parent | 58f8caeca47fed501720bcaa61c12b032bc5953d (diff) | |
02: ctf
Diffstat (limited to 'indieweb-micro/themes/MinIndie/layouts/partials/webmentions.html')
| -rw-r--r-- | indieweb-micro/themes/MinIndie/layouts/partials/webmentions.html | 21 |
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"; |
