snarfed / bridgy

📣 Connects your web site to social media. Likes, retweets, mentions, cross-posting, and more...
https://brid.gy
Creative Commons Zero v1.0 Universal
710 stars 52 forks source link

Unexpected Webmentions #1476

Closed vanzasetia closed 1 year ago

vanzasetia commented 1 year ago

I have a Mastodon post that contains the following URL: https://vanzasetia.site/blog/frontend-mentor-bundle/

This is the URL to the Mastodon post: https://mastodon.social/@vanzasetia/110326846429104996

I received the likes and the reposts webmentions. but Bridgy also sends the same mentions to the following URL: https://vanzasetia.site/.

If you see on my webmention feed—https://webmention.io/api/mentions.html?token=EYTzYK2WnWAPZHFOSJV9ew—the webmentions from Robin Hoover gets duplicated for both like and repost. The webmentions from Bob Monsour were also duplicated—both the likes and the comment—but I deleted those yesterday.

As a result, the https://vanzasetia.site/ will get the webmentions from other pages.

snarfed commented 1 year ago

Hi @vanzasetia! Looks like https://mastodon.social/@vanzasetia/110326846429104996 has two links to your site, one to https://vanzasetia.site/blog/frontend-mentor-bundle/ and one to https://vanzasetia.site/ . That second link is why Bridgy is currently sending webmentions for it to your home page as well as to the blog post.

vanzasetia commented 1 year ago

Hi, @snarfed!

There is only one link on that post (https://mastodon.social/@vanzasetia/110326846429104996).

I checked it. Now, I guarantee that there is only one link. I copy-paste the raw post.

I create the first Frontend Mentor Bundle. This is a collection of people, blog posts, solutions, and resources about Frontend Mentor.

This is inspired by @bobmonsour@indieweb.social who creates The 11ty Bundle.

#FrontendMentor #CodeChallenge
https://vanzasetia.site/blog/frontend-mentor-bundle/

I am guessing that this happens because the pinned post contains https://vanzasetia.site/. So, the Webmentions will also be sent to the URL on that post (https://mastodon.social/@vanzasetia/110326846429104996) and the URL on the pinned post (https://mastodon.social/@vanzasetia/110265441720333513).

snarfed commented 1 year ago

Hmm! It's not related to your pinned post, but you're right, the https://mastodon.social/@vanzasetia/110326846429104996 post is a bit confusing. If you look at the link preview at the bottom of it, that preview card links to your home page, https://vanzasetia.site/ :

image

Looking at the raw AS2 for your post (below, pruned down a bit), its content has a couple links, and the second one is marked up awkwardly, which Mastodon likes to do, but you're right that it's not a straight link to your home page, and I don't see one elsewhere in the AS2 object either. So I don't yet know where that link preview came from, or where Bridgy is getting it from. My best guess is that Bridgy is extracting it incorrectly from Mastodon's spans that break up the visible text URL in the content.

$ curl -H 'Accept: application/activity+json' 'https://mastodon.social/@vanzasetia/110326846429104996' | json_pp
{
   "@context" : "...",
   "type" : "Note",
   "id" : "https://mastodon.social/users/vanzasetia/statuses/110326846429104996",
   "url" : "https://mastodon.social/@vanzasetia/110326846429104996"
   "attributedTo" : "https://mastodon.social/users/vanzasetia",
   "cc" : [
      "https://mastodon.social/users/vanzasetia/followers",
      "https://indieweb.social/users/bobmonsour"
   ],
   "content" : "<p>I create the first Frontend Mentor Bundle. This is a collection of people, blog posts, solutions, and resources about Frontend Mentor.</p><p>This is inspired by <span class=\"h-card\"><a href=\"https://indieweb.social/@bobmonsour\" class=\"u-url mention\">@<span>bobmonsour</span></a></span> who creates The 11ty Bundle.</p><p><a href=\"https://mastodon.social/tags/FrontendMentor\" class=\"mention hashtag\" rel=\"tag\">#<span>FrontendMentor</span></a> <a href=\"https://mastodon.social/tags/CodeChallenge\" class=\"mention hashtag\" rel=\"tag\">#<span>CodeChallenge</span></a><br /><a href=\"https://vanzasetia.site/blog/frontend-mentor-bundle/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">vanzasetia.site/blog/frontend-</span><span class=\"invisible\">mentor-bundle/</span></a></p>",
   "contentMap" : {
      "en" : "<p>I create the first Frontend Mentor Bundle. This is a collection of people, blog posts, solutions, and resources about Frontend Mentor.</p><p>This is inspired by <span class=\"h-card\"><a href=\"https://indieweb.social/@bobmonsour\" class=\"u-url mention\">@<span>bobmonsour</span></a></span> who creates The 11ty Bundle.</p><p><a href=\"https://mastodon.social/tags/FrontendMentor\" class=\"mention hashtag\" rel=\"tag\">#<span>FrontendMentor</span></a> <a href=\"https://mastodon.social/tags/CodeChallenge\" class=\"mention hashtag\" rel=\"tag\">#<span>CodeChallenge</span></a><br /><a href=\"https://vanzasetia.site/blog/frontend-mentor-bundle/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">vanzasetia.site/blog/frontend-</span><span class=\"invisible\">mentor-bundle/</span></a></p>"
   },
   "conversation" : "tag:mastodon.social,2023-05-07:objectId=446021220:objectType=Conversation",
   "published" : "2023-05-07T10:07:57Z",
   "tag" : [
      {
         "href" : "https://indieweb.social/users/bobmonsour",
         "name" : "@bobmonsour@indieweb.social",
         "type" : "Mention"
      },
      {
         "href" : "https://mastodon.social/tags/FrontendMentor",
         "name" : "#FrontendMentor",
         "type" : "Hashtag"
      },
      {
         "href" : "https://mastodon.social/tags/codechallenge",
         "name" : "#codechallenge",
         "type" : "Hashtag"
      }
   ],
   "to" : [
      "https://www.w3.org/ns/activitystreams#Public"
   ],
   "..."
}
snarfed commented 1 year ago

I haven't been able to reproduce this yet. Bridgy's original post discovery code correctly returns these URLs for this activity, not including https://vanzasetia.site/ 😐

vanzasetia commented 1 year ago

Yeah, that is confusing. 😅

It is unexpected that the card preview has https://vanzasetia.site/ instead of https://vanzasetia.site/blog/frontend-mentor-bundle/

Do you have any idea how I stop getting mentions on https://vanzasetia.site/?

I do not want to keep deleting the Webmentions on https://vanzasetia.site/ every time another page gets Webmentions.

snarfed commented 1 year ago

Your first two posts linked to https://vanzasetia.site/, and this latest post has the odd link preview card that links to https://vanzasetia.site/ . Let's see what happens with your next post, assuming neither of those things happens to it.

vanzasetia commented 1 year ago

I just notice that all the posts that contain https://vanzasetia.site/ have the link preview card of https://vanzasetia.site/.

For example:

I also removed all the pinned posts to see if that has any effect. It turned out that it has no effect. The link preview card is still https://vanzasetia.site/.

Is this a bug? No.

I just remember about canonical <link> element: <link rel="canonical" href="https://vanzasetia">. That element is on every webpage including the blog posts.

After I remove the canonical <link> element from all the other pages—except the homepage—I create two new posts: https://mastodon.social/@vanzasetia/110349906891290679 and https://mastodon.social/@vanzasetia/110349930534865555. The URL of the link preview card of each of them is the same URL on the post.

I think I have solved the issue. It turned out that the issue is coming from my code. It is my fault.

I apologize for taking your time.

vanzasetia commented 1 year ago

Luckily, a person likes one of my new posts (https://mastodon.social/@vanzasetia/110349930534865555). Bridgy only sends the Webmention to the URL on the post (https://vanzasetia.site/blog/i-like-web-clubs/). No Webmention is sent to https://vanzasetia.site/. This proves that it is not a bug from Bridy.

Anyway, I am not sure which type of close choice I should choose. "Close with comment" or "Close as not planned"?

snarfed commented 1 year ago

Oh wow, good sleuthing, great find. No worries! And I don't know about closing this either, I guess it's not planned. 😁