Jeremy Felt's web

Working through displaying Webmentions

Published Sunday evening 🌖

Now that this site supports Webmentions, I’ve been having some fun digging into how I’d like them to be presented.

The theme I’m using is very bare-bones. I created it using Underscores a couple years ago when I decided I had lost touch with the code I was using and for some reason wanted to get back in touch? I don’t know, but I like it.

I created a plugin specifically for my adjustments to the IndieWeb, Webmention, and Semantic Linkbacks plugins. There are a couple scripts and styles I decided I didn’t need as well as a custom comment walker I decided to remove.

At the same time, I created another plugin specifically for adjustments to WordPress. I removed all default emoji handling to see if things would display better in feed readers and adjusted some of the markup output by default—sorry, Windows Live Writer.

Back to comments.

Before I started, the theme’s comment template output everything stored in the comments table as if it was a comment. This makes sense because WordPress doesn’t have a complete idea of “custom comment types”, so it treats them all the same.

The first thing I did was break the query for all comments into comment types so that I could display them in separate sections. WordPress has a function that should do this, separate_comments(), but it is hard coded to support only comment, trackback, pingback, and pings. I have my eye on proposing a filter there, but I’m guessing there are wider concerns with comment types that need to be addressed at the same time.

I’ll revisit that code in the near future. I was just winging it today and never actually went back to review some of those decisions. 🙂

I’m starting with a section for “Likes”, a section for “Mentions”, and a section for “Replies”. Once I get more familiar with other actions and how I see them being used, I’ll likely mix things up a little more.

For Likes and Mentions, I decided to keep things simple and display the avatar, name, action, and date. This displays a bit more than a facepile, but less than a full comment.

It’s been interesting seeing what data actually comes along with a Like or a Mention—sometimes it’s the full post—and it’d be fun to figure out the right way to display that in the future. I could see manually editing some mentions and displaying them differently so that the context is displayed. I envision something like the first 100 characters before and after the actual mention itself.

I removed support for comment navigation, as it’s something I don’t want to deal with right now and I have the option to paginate comments turned off in WordPress.

I was low-key annoyed that wp_list_comments() only supported a style of ol or li, but then went further to the comment walker and saw div was also a supported option. I created a new trac ticket for that and tagged it as a good first bug for anyone who may want to contribute.

My next annoyance is that comment author names are wrapped with <b> and so here I am deciding that of course I should add a custom walker. Exciting!

Of course now I’ve screwed this all up somehow and the reply links aren’t working.

Ahhh, I see! I tried to shrink the amount of markup used around each comment, but the default reply script used in WordPress expects a bit more structure. Added that back for now.

I’ve temporarily adjusted the “Reply” text below each comment to “Reply to {comment author name}”. I think I’d like to adjust this even more so that on nested comments, it includes everyone’s name. Something like “Reply to Jeremy Felt, Alice, and Bob” on a thread in which all have participated would be cool. Part of me wants to shorten that to first names only, though that starts to make assumptions.

One quirk now that I have this all in place is that I’ve replied to “mentions” in the past, which are now displayed in their own area of the page. These replies are now displayed outside of that context. I’m guessing this won’t be an issue in the future, though if I ever do want to reply to a mention, it’d be cool if there was a way to convert the mention into a reply for purposes of display. I’ll think some more on that.

Almost there. Time for another bad decision.

It looks like some multi-paragraph Webmentions are coming in or being stored without paragraph tags. Rather than dive into really testing that, I took the lazy way out and replaced single line breaks with double line breaks so that wpautop() can add paragraphs as intended. This seems to have worked, but I’m sure I’ll run into an edge case at some point.

Okay! Theme deployed. Deployments setup for the new plugins. All is right.

Version 0.0.2 of a new vibe for Webmentions is live on the site. 🕺🏻

Responses and reactions

Replies

  • I’m really enjoying having Webmentions on my blog. I have a feature request, if I may?
    Occasionally, a blog post of mine will go a bit viral on Twitter. Then I’m hit with hundreds of WP comments – and emails – which I have to manually delete. Is there any way of telling the WordPress plugins that I *only* want comments – and it should ignore “likes” and “reposts”?
    Thanks!

    • Thanks, Aaron! I’m finding it’s helping me think through where I want to go next. I like the idea of showing the name of the post. I _think_ that’s similar to how WordPress has shown pingbacks in the past. Which reminds me to look into whether I can take over pingbacks entirely and treat them as webmentions.

  • Why not, right?

    I shipped a great bug yesterday. A big thanks to Chris Aldrich for catching that and sending me a DM today to let me know.

    With all my cleverness around separating comment types for display below posts, I forgot to check for cases where there was some kind of Webmention, but no regular or reply comments. That resulted in an empty array being passed to the comment__in argument for get_comments(), which then resulted in every single comment! A conversation, indeed.

    In the process of fixing that, I also decided to only show each section—Likes, Mentions, etc…—if that section had at least one action. This makes more sense to me than empty headings. I also added “bookmark” as an accepted type.

    There are a handful of other types left via the Semantic Linkbacks plugin and I should probably decide how to manage them.

    I kind of like the idea of “read” being something I see in the WordPress dashboard, but not on the front-end. I made that the case for now along with all of the RSVP, invited, watch, follow, listen, tag, and repost actions. I’ll revisit those in the future if I think of something fun to do with them. For now, I’ll still get them in my dashboard.

    The idea of “favorite” has become synonymous with “like” for me when I think about it in the context of social networks. I’m going to mirror those for now and continue to think about differences. I could almost see doing the same thing with “bookmark”, but I’ll keep them separate for the time being.

    Now that I’ve adjusted what reactions show up, the get_comments_number() count is not to be trusted. Instead of displaying the number of reactions, I decided to remove the count entirely. For now, I’ll leave the “16 comments” thing alone on archive views just to confuse everyone.

    At some point during the day, I was hoping for custom comment statuses in WordPress as a way to separate public and private comments in some kind of workflow. There’s an open trac ticket that’s had some traction in the past and I left some feedback. I was also happy to see a bit of recent traffic on the custom comment types ticket. I’m not sure how I want to chime in yet, but I think they would be very useful.

    There is a part of me that things comments need to be approached entirely different. The first thing I would consider doing is creating a wp_comment_author table that tracks unique authors in some way. I’ve only thought through the good parts of that and not the bad, so it may be a ridiculous idea. But I would like to do things like “mark author as spam” and have that combination of name/email/website never appear again. To do that in the current data structure, you’d have to store data in strange ways to try and match things when a new comment comes in.

    I’ve been working on a ridiculous plugin, the Self Sustaining Spam Stopper, to see if every day spam blocking is possible without the use of a centralized service and without having to spend a lot of time. It’s already catching most spam, though some tooling around marking words, phrases, and paragraphs as “always spam” from the WordPress admin will be much more interesting.

    Things to dig into next:

    All of these actions are great in the Semantic Linkbacks plugin, but I’ve completely lost track of where they’re standardized. I thought I remembered reading the Webmention spec the other day and not seeing them there. I need to investigate a little bit more and see how they’re created and if there are more specific intentions.
    I’m not completely sure yet, but I don’t think the “approve & whitelist” option via the Webmention plugin is working for me. I’m still finding myself approving things received from the allowed list of domains. I need to verify / troubleshoot this.

    Propose that “approve & whitelist” be changed to something like “approve & allowlist” or “always allow”.
    I think I’d like a “replies” post type I can use to reply to comments on other peoples’ sites. I want to keep my main feed as standard posts without generating a kind of firehose.
    I may extend on that to my own “likes” so that I can notify people when I like their posts.
    And I want to make sure I have a clever way of RSVPing to things. I’m headed to the IndieWeb Summit in June and sending an RSVP from this site will be fun. I’m not even linking to it yet just in case it accidentally handles the RSVP for me. 😂

  • Liked Working through displaying Webmentions by Jeremy Felt (jeremyfelt.com)

    Now that this site supports Webmentions, I’ve been having some fun digging into how I’d like them to be presented.
    The theme I’m using is very bare-bones. I created it using Underscores a couple years ago when I decided I had lost touch with the code I was using and for some reason wanted to g…

    This should be an interesting experiment to watch.

    Syndicated copies to:

  • Leave a Reply

    The only requirement for your mention to be recognized is a link to this post in your post's content. You can update or delete your post and then re-submit the URL in the form to update or remove your response from this page.

    Learn more about Webmentions.