diff --git a/_includes/head.html b/_includes/head.html
index 3b880e9..c805316 100644
--- a/_includes/head.html
+++ b/_includes/head.html
@@ -78,7 +78,11 @@
getMentions,
renderMentions,
} from "/assets/js/webmention-utils.mjs";
-
+ const ignoreAuthorUrls = [
+ "https://social.ayco.io/@ayo",
+ "https://fosstodon.org/@ayo",
+ "https://m.webtoo.ls/@ayo",
+ ];
const ignorePaths = [
"/",
"/categories/",
@@ -96,7 +100,11 @@
if (!ignorePaths.includes(url.pathname)) {
const mentions = getMentions(url.toString())
.then((mentions) => {
- renderMentions(mentions, ".blog-post__web-mentions");
+ renderMentions(
+ mentions,
+ ".blog-post__web-mentions",
+ ignoreAuthorUrls
+ );
})
.catch((err) => console.log("err", err));
}
diff --git a/assets/js/webmention-utils.mjs b/assets/js/webmention-utils.mjs
index 0e3cbb2..cd07a39 100644
--- a/assets/js/webmention-utils.mjs
+++ b/assets/js/webmention-utils.mjs
@@ -1,39 +1,43 @@
-export function renderMentions(mentions, rootSelector) {
+export function renderMentions(mentions, rootSelector, ignoreAuthorUrls = []) {
const webMentionsSection = document.querySelector(rootSelector);
- mentions = mentions.filter((m) => m["wm-private"] !== true);
- if (mentions.filter((m) => m.author.name !== "Ayo Ayco").length)
+ mentions = mentions.filter(
+ (m) => m["wm-private"] !== true && !ignoreAuthorUrls.includes(m.author.url)
+ );
+
+ console.log(mentions);
+
+ if (mentions.length) {
webMentionsSection.innerHTML =
"
From Across the Web
";
- const heading = {
- "like-of": "👍 {x} Likes",
- "repost-of": "🔁 {x} Reposts",
- "bookmark-of": "🔖 {x} Bookmarks",
- "mention-of": "💬 {x} Mentions",
- "in-reply-to": "💬 {x} Replies",
- };
+ const heading = {
+ "like-of": "👍 {x} Likes",
+ "repost-of": "🔁 {x} Reposts",
+ "bookmark-of": "🔖 {x} Bookmarks",
+ "mention-of": "💬 {x} Mentions",
+ "in-reply-to": "💬 {x} Replies",
+ };
- ["like-of", "repost-of", "bookmark-of"].forEach((type) => {
- const mentionsOfType = mentions
- .filter((m) => m.author.name !== "Ayo Ayco")
- .filter((m) => m["wm-property"] === type);
+ ["like-of", "repost-of", "bookmark-of"].forEach((type) => {
+ const mentionsOfType = mentions.filter((m) => m["wm-property"] === type);
- if (mentionsOfType.length) {
- const avatarBlock = createAvatarBlock(mentionsOfType, heading[type]);
- webMentionsSection.append(avatarBlock);
- }
- });
+ if (mentionsOfType.length) {
+ const avatarBlock = createAvatarBlock(mentionsOfType, heading[type]);
+ webMentionsSection.append(avatarBlock);
+ }
+ });
- ["in-reply-to", "mention-of"].forEach((type) => {
- const replies = mentions.filter((m) => m["wm-property"] === type);
+ ["in-reply-to", "mention-of"].forEach((type) => {
+ const replies = mentions.filter((m) => m["wm-property"] === type);
- if (replies.length) {
- // render on webmentions section
- const repliesWrapper = createRepliesBlock(replies, heading[type]);
- webMentionsSection.append(repliesWrapper);
- }
- });
+ if (replies.length) {
+ // render on webmentions section
+ const repliesWrapper = createRepliesBlock(replies, heading[type]);
+ webMentionsSection.append(repliesWrapper);
+ }
+ });
+ }
}
function createRepliesBlock(replies, heading) {