Showing Mastodon Reactions on a Statamic Website
A few weeks ago, I rebooted my website with the intention of publishing more content. To inject a bit more "interactivity" into it, I decided to display Mastodon reactions related to my articles (likes, reposts, responses). Yesterday, I finally had the time to bring this feature to life.
Part 1: Webmentions, webmention.io & brid.gy
There are many articles how to implement webmentions utilizing brid.gy and webmention.io.
The process is more or less:
- Link your social media account to brid.gy, which scans for posts and reactions and notifies related websites that contain...
- ...a
<link rel="webmention" ...>
in their<head>
, leading to a request on webmention.io, which then provides an API to fetch all those mentions. - Developers pull data from the API for their desired use.
Having performance and privacy in mind I implemented the following:
- A Laravel command
webmentions:fetch
retrieves all webmentions from webmention.io and saves them as{article-slug}.json
in local storage. - A Statamic tag
{{ webmentions :slug="slug" wm-property="like-of" }}
parses the corresponding JSON and filters for e. g. likes. - A Statamic modifier
{{ ... | remove_initial_mentions }}
that removes@
mentions at the start of a post. - A Statamic modifier
{{ ... | initials:2 }}
, which returns the first letters of the specified number of words. - A cron job on ploi.io that runs
webmentions:fetch
twice daily and regenerates my static pages.

If you're curious about the complete feature's code, check out the commit on GitHub. But, continue reading before you decide to implement it yourself.
Part 2: Doubts About the Results
There are several posts voicing concerns about webmention.io and brid.gy. I thought I had optimized it well:
- I
.gitignore
d all generated JSONs, so the data isn't on GitHub but only temporarily on my server. - I handled fetching server-side, so my website visitors wouldn't need to connect to third-party APIs.
- I opted not to display avatars, using initials instead.
However, once everything was in place and I saw the posts on my website, it didn't feel right.
So here's my take on it:
Posts live in the context of their platform, and even if it's public, that context always matters.
Interestingly, I've had read similar thoughts in another article, but it seems I needed to experience it firsthand to realize that exposing people's reactions without their explicit consent goes against my fourth principle for web development:
🫡 Trustworthiness: Respect for security, privacy and reliability.
Part 3: Mastodon API
This morning I decided to replace my initial implementation and go a different route. I set up:
- An a Array field in Statamic blueprint for storing
id
,replies_count
,reblogs_count
andfavourites_count
. - A Laravel command to fetch the relevant Mastodon API data for each post's
id
, updating the appropriate fields. - A cron job on Ploi.io to run the command regularly.
This approach brought several technical advantages:
- Optimized performance and a lighter setup.
- Reduced dependency on third-party services, which by the way proved somewhat unreliable during my tests.
- Tighter integration with how Statamic operates, benefiting from its automatic cache invalidation.
Feel free to check out the code yourself in this commit on GitHub.

And last but not least, it aligns so much better with my commitment to transparency.