Skip to content

Piero Bosio Social Web Site Personale Logo Fediverso

Social Forum federato con il resto del mondo. Non contano le istanze, contano le persone

How to go block-less with the WordPress ActivityPub plugin

  • Being the web performance zealot I am, I strive to having as little JavaScript on my sites as possible. JavaScript after all has to be downloaded and has to be executed, so extra JS will always have a performance impact even when in the best of circumstances it exceptionally does not impact Core Web Vitals (which are a snapshot of the bigger performance and sustainability picture). Hence when adding blocks in WordPress, I check if the block is entirely rendered server-side and if not I look for alternatives to avoid multiple files from wp-includes/js/dist (and in the case of some 3rd party blocks the entire React JS and more) being loaded.

    For that reason I tested the WordPress ActivityPub plugin with the reactions block loaded as per these guidelines and indeed it triggers the loading of hooks.min.jsi18n.min.jsurl.min.js, api-fetch.min.js (all in wp-includes/js/dist) and 2 files from the plugin itself (/wp-content/plugins/activitypub/build/reactions/view.js and /wp-content/plugins/activitypub/build/remote-reply/view.js).

    To be able to reduce the dependency on those JavaScript files, 2 questions needed to be answered; how to have reactions (which I like a lot) without the JavaScript-driven rendering and what is that remote-reply thing.

    Starting with the latter; “remote-reply” handles the federation of local comments on reactions (comments) from the Fediverse, showing a modal window where the commenter is asked what ActivityPub account they want to post the reaction from. I decided this was not that important for me and –with some help from Matthias @pfefferle who always gives great support- came up with a couple of lines of code to not “do” remote-reply on this blog.

    Now that Fediverse reactions block is very nice and I did want reactions showing on my blog, so I started looking at the database and the ActivityPub plugin code and saw that all Fediverse reactions were stored in the wp-comment en wp-comment-meta db-tables and were in fact accessible with the WP_Comment_Query class and with quite a bit of trial and error I ultimately ended up with a totally server-side generated solution that looked pretty nice (and similar to the JavaScript-rendered one).

    If you’re interested, you can find the code in this gist, but don’t expect it to be good. Some negatives include no language handling, unminified CSS inline and the placement of the reactions might not work on every theme as I hook into the comments_template action to try to show them just before the comments. But who knows it might just work for you as well?

  • pfefferle@mastodon.socialundefined pfefferle@mastodon.social shared this topic
  • Being the web performance zealot I am, I strive to having as little JavaScript on my sites as possible. JavaScript after all has to be downloaded and has to be executed, so extra JS will always have a performance impact even when in the best of circumstances it exceptionally does not impact Core Web Vitals (which are a snapshot of the bigger performance and sustainability picture). Hence when adding blocks in WordPress, I check if the block is entirely rendered server-side and if not I look for alternatives to avoid multiple files from wp-includes/js/dist (and in the case of some 3rd party blocks the entire React JS and more) being loaded.

    For that reason I tested the WordPress ActivityPub plugin with the reactions block loaded as per these guidelines and indeed it triggers the loading of hooks.min.jsi18n.min.jsurl.min.js, api-fetch.min.js (all in wp-includes/js/dist) and 2 files from the plugin itself (/wp-content/plugins/activitypub/build/reactions/view.js and /wp-content/plugins/activitypub/build/remote-reply/view.js).

    To be able to reduce the dependency on those JavaScript files, 2 questions needed to be answered; how to have reactions (which I like a lot) without the JavaScript-driven rendering and what is that remote-reply thing.

    Starting with the latter; “remote-reply” handles the federation of local comments on reactions (comments) from the Fediverse, showing a modal window where the commenter is asked what ActivityPub account they want to post the reaction from. I decided this was not that important for me and –with some help from Matthias @pfefferle who always gives great support- came up with a couple of lines of code to not “do” remote-reply on this blog.

    Now that Fediverse reactions block is very nice and I did want reactions showing on my blog, so I started looking at the database and the ActivityPub plugin code and saw that all Fediverse reactions were stored in the wp-comment en wp-comment-meta db-tables and were in fact accessible with the WP_Comment_Query class and with quite a bit of trial and error I ultimately ended up with a totally server-side generated solution that looked pretty nice (and similar to the JavaScript-rendered one).

    If you’re interested, you can find the code in this gist, but don’t expect it to be good. Some negatives include no language handling, unminified CSS inline and the placement of the reactions might not work on every theme as I hook into the comments_template action to try to show them just before the comments. But who knows it might just work for you as well?

    @frank awesome! would you maybe like to contribute this to the plugin? I am thinking about a snippets "directory", to show how the plugin can be extended with special features!?

    I will create a barebone folder with a readme for that!?

  • Being the web performance zealot I am, I strive to having as little JavaScript on my sites as possible. JavaScript after all has to be downloaded and has to be executed, so extra JS will always have a performance impact even when in the best of circumstances it exceptionally does not impact Core Web Vitals (which are a snapshot of the bigger performance and sustainability picture). Hence when adding blocks in WordPress, I check if the block is entirely rendered server-side and if not I look for alternatives to avoid multiple files from wp-includes/js/dist (and in the case of some 3rd party blocks the entire React JS and more) being loaded.

    For that reason I tested the WordPress ActivityPub plugin with the reactions block loaded as per these guidelines and indeed it triggers the loading of hooks.min.jsi18n.min.jsurl.min.js, api-fetch.min.js (all in wp-includes/js/dist) and 2 files from the plugin itself (/wp-content/plugins/activitypub/build/reactions/view.js and /wp-content/plugins/activitypub/build/remote-reply/view.js).

    To be able to reduce the dependency on those JavaScript files, 2 questions needed to be answered; how to have reactions (which I like a lot) without the JavaScript-driven rendering and what is that remote-reply thing.

    Starting with the latter; “remote-reply” handles the federation of local comments on reactions (comments) from the Fediverse, showing a modal window where the commenter is asked what ActivityPub account they want to post the reaction from. I decided this was not that important for me and –with some help from Matthias @pfefferle who always gives great support- came up with a couple of lines of code to not “do” remote-reply on this blog.

    Now that Fediverse reactions block is very nice and I did want reactions showing on my blog, so I started looking at the database and the ActivityPub plugin code and saw that all Fediverse reactions were stored in the wp-comment en wp-comment-meta db-tables and were in fact accessible with the WP_Comment_Query class and with quite a bit of trial and error I ultimately ended up with a totally server-side generated solution that looked pretty nice (and similar to the JavaScript-rendered one).

    If you’re interested, you can find the code in this gist, but don’t expect it to be good. Some negatives include no language handling, unminified CSS inline and the placement of the reactions might not work on every theme as I hook into the comments_template action to try to show them just before the comments. But who knows it might just work for you as well?

    @frank @pfefferle

    I have a blockless theme. There are a bunch of things which I deactivate.

    See https://gitlab.com/edent/blog-theme/-/blob/master/includes/remove.php?ref_type=heads#L127

    I don't have reactions though. I keep going back and forth about whether I want them and whether it is possible to back-fill them.

  • @frank @pfefferle

    I have a blockless theme. There are a bunch of things which I deactivate.

    See https://gitlab.com/edent/blog-theme/-/blob/master/includes/remove.php?ref_type=heads#L127

    I don't have reactions though. I keep going back and forth about whether I want them and whether it is possible to back-fill them.

    @Edent @frank that looks way nicer than our current "static" implementation in the Webmentions plugin btw.

    what do you think: https://github.com/Automattic/wordpress-activitypub/pull/2909


Gli ultimi otto messaggi ricevuti dalla Federazione
Post suggeriti
  • 0 Votes
    3 Posts
    15 Views
    @pfefferle@mastodon.social I'm frankly surprised I ran into a side effect of this so soon after you updated the site :laughing: Either the PR is to be reverted or perhaps WP should handle requests to the URL encoded address :shrug: But after briefing myself on the root cause, it does seem weird that there exist actors with unicode in their ID. Might be if that is the case you should disregard them as non-compliant, who knows. cc @silverpill@mitra.social
  • 0 Votes
    1 Posts
    13 Views
    Right on the heels of WordPress 6.9 we released a new version of the ActivityPub plugin, making quote comments visible in the Reactions block and bringing you new ways of customizing your author pages.Quotes Join the Reactions PartyWhen someone quotes your post on Mastodon or other Fediverse platforms, you’ll now see it right alongside your likes and reposts. Quotes get their own row in the Fediverse Reactions display, making it easy to see at a glance who’s building on your ideas and adding their own commentary.Behind the scenes, we improved how we’re detecting quotes. Different platforms have their own ways of handling quote posts, and not all of them speak the same language. The plugin now understands these variations better, so whether someone quotes you from Mastodon, Misskey, or elsewhere, it just works.This means your engagement stats tell a fuller story. A quote isn’t just a repost—it’s someone adding their voice to yours, and now WordPress can recognize and display that distinction.Show Off Your Fediverse IdentityIf you’ve set up extra fields on your Fediverse profile—things like your website, pronouns, location, or links to other accounts—you can now display them directly on your WordPress site with the new Extra Fields block.Drop it onto any page, post, or your author archive template, pick a style that fits your theme, and your profile details appear right where your visitors can see them. Choose from a clean table layout, a stacked list, or styled cards. You can also control how many fields to show and customize colors to match your site.ChangelogAddedAdd documentation guide for using ActivityPub blocks in classic themes with Block Template PartsAdded a new Fediverse Extra Fields block to display ActivityPub extra fields, featuring compact, stacked, and card layouts with flexible user selection options.Added support for quote comments, improving detection and handling of quoted replies and links in post interactions.Add notifications for boosts, likes, and new followers in Mastodon apps via the Enable Mastodon Apps pluginAdds support for turning tags, categories, and custom taxonomies into federated collections in the Reader view so you can browse and follow topics more seamlessly.Prevent email notifications for comments on ActivityPub custom post types.Send a Reject activity when a quote comment is deleted, revoking previous quote permissions and ensuring consistent inbox handling.Store and retrieve webfinger acct for remote actors to improve identification and reduce lookupsChangedImprove gallery and image block markup for ap_posts with better alt text and optimized layouts.Improve support for media attachments by handling Audio, Document, and Video object types in addition to Images.Maintain consistent return values in Create handler.Remove trailing hashtags from incoming posts to prevent duplication with taxonomy tags.Store comments and reactions from followed actors on reader posts, and keep them separate from your site’s comments in wp-admin.Update compatibility testing for PHP 8.5 and WordPress 6.9Use tag name instead of slug for hashtag display.FixedAlways includes id, first, and last links in collection responses, ensuring followers and following lists display correctly in Mastodon.Automatically approves reactions on ActivityPub posts in the Reader view for a smoother, more seamless interaction experience.Deliver public activities to followers only.Disable REST API endpoints for internal post types.False mention email notifications for users in CC field without actual mention tags.Fix “Filename too long” errors when downloading attachments from URLs with query parameters (e.g., Instagram CDN URLs).Fix make_clickable corrupting existing anchor tags in ActivityPub contentFix PHP 8.5 deprecation warnings for ReflectionProperty::setAccessible() and ReflectionMethod::setAccessible()Improved handling of unusual activity data to avoid errors when activities contain unexpected formats.Preserve original ActivityPub activity timestamps when creating posts and comments instead of using current time.Prevented duplicate email notifications when ActivityPub instances re-send Follow activities for already-following actors.Prevents unwanted comment types—like pingbacks, trackbacks, notes and custom system comments, from being federated, ensuring only real user comments are shared with the fediverse.Removed a redundant instruction from the custom post content settings to simplify the UI.Reply block now shows fallback link when oEmbed fails instead of empty div.Simplified reply links by removing special handling for federated comments, making replies work the same for all comments where replying is allowed.Undefined array key warning in Scheduler::async_batch when called without arguments.DownloadsWordPress.org: activitypub.7.7.0.zipGitHub: tag/7.7.0Thank You!As always, a huge thanks to everyone who contributed code, reported bugs, tested early builds, and shared ideas. Every bit of feedback helps make ActivityPub for WordPress better for the whole community.Version 7.7.0 is available now—update and let us know what you think!
  • 0 Votes
    3 Posts
    16 Views
    @_elena https://www.youtube.com/watch?v=NB1qppAPxk4
  • 0 Votes
    1 Posts
    15 Views
    "The conversation also pulled in voices from outside the WordPress bubble. Web pioneer @davew, known for his work on blogging, RSS & podcasting, left a comment on Hamze’s post: “I love this piece—I see the same rebirth possible.” He linked to his August essay, Think Different about #WordPress, where he compared its potential to federated platforms like Mastodon & Bluesky and highlighted underused strengths like its stable APIs and real-time RSS features."https://www.therepository.email/nick-hamzes-cool-kids-post-kicks-off-fresh-debate-on-wordpresss-image-problem