Embed Mastodon Statuses in WordPress

After the controversial changes to Twitter’s @reply feature, which no longer counts usernames towards the 140-character limit, Mastodon registrations rose sharply. Mastodon is a free, open source, decentralized network that has many similarities to Twitter. The software, named in honor of its creator’s favorite metal band, was launched in October and registered 24,000 users in the first six months. A strong negative reaction to Twitter’s changes has fueled a spike in Mastodon registrations. In the last week alone, the software’s user base has grown from 237,000 users on April 15 to more than 414,000 users today.

Mastodon is different from Twitter in that it is broken up into different independently-hosted instances. Whereas Twitter has struggled to combat trolls and abuse on its platform, Mastodon instances can each declare and enforce their own rules. For example, the flagship Mastodon.social instance bans content that is illegal in Germany or France, such as Nazi symbolism and Holocaust denial, excessive advertising, racism, sexism, and other undesirable posts.

Mastodon’s Tweetdeck-style interface allows users to post “toots” with a 500-word character limit. Toots can also be published with a content warning so that users can choose whether to view it.

With all the increased activity around Mastodon this week, there was bound to be someone with the desire to display toots on their website. The first plugin for bringing Mastodon content into WordPress has landed in the plugin directory. Embed Mastodon was created by David Libeau, a French developer and Mastodon enthusiast. It allows users to embed toots using a shortcode.

“I created this plugin because Numerama, a french tech website, was saying that it could be cool to embed Mastodon statuses, like with Twitter, in WordPress,” Libeau said. “I was thinking the same when I wrote a small article on my personal blog. I am using both Twitter and Mastodon but want to progressively leave Twitter.”

Libeau said he is not a WordPress developer and Mastodon Embed is his first plugin. He does not know if it’s coded well but said users may be interested in an alternative plugin on GitHub that is a complete rewrite of his effort. The rewrite includes multiple embeds, caching, proper shortcode initialization, and fallback to “direct” embeds if embed via iframe is forbidden.

Libeau said he doesn’t know what will happen to his plugin in light of the rewrite, but he is continuing to develop small tools for Mastodon users. Mastodon has an open API for apps and services, which makes it easy for developers to build things that integrate with it.

After testing the Mastodon Embed plugin I found that it works but may have a couple of styling issues with the link display. If you find that it’s not working, it’s possible that your particular Mastodon instance configuration does not allow embedding via iFrame. To resolve this you may need to contact the admin of the instance or use the fork of the plugin that has a fallback for this scenario. If you find a bug with the Mastodon Embed plugin hosted on WordPress.org, you can log an issue on Libeau’s Mastodon Tools repository.

10 Comments


  1. It is the first time I hear about this platform. Interesting then, why Micro.blog was created as these two look very similar.

    Report


    1. Well .. Mastodon implements OStatus though, and is completely open source. Micro.blog doesnt give out much information about that or whats its based on.

      There are quite a bunch of different platforms implementing or using it (OStatus), including GNUSocial, identi.ca and other open microblogging efforts.

      Certainly, microblogging solutions are looking similar, because the topic is a common one. Try tumblr, try twitter, try a mix between both .. that might be a blog, a social network, or an irc-meets-forum-meets-text message platform like Mastodon.

      cu, w0lf.

      Report


  2. Testing the other GitHub fork… not working in SSL environment but discussing it with the plugin author…
    Libeau’s work is a way too basic ;) but first step though…

    Report


  3. Nice ! :)
    Deeper inter-operability could be done with Mastodon, if it was supported by Zapier or IFTTT, but we can use user RSS to do some basic things.
    That said, any volunteer could register Mastodon in Zapier thanks to it’s API.

    Report


  4. BTW: “direct” embed refers to inserting actual content instead of using an iframe. I’ve reverse-engineered the original styling of the Mastodon statuses (“toots”), thus the styling is not perfect, but a) the LESS file from which the CSS is derived is being supplid as well and b) there is a filter hook so you may roll your own CSS, too.

    I’m going to add this to the plugin documentation as soon as possible, too.

    Report


  5. Thanks for the post, I never knew this existed and it sounds like it’s more flexible than Twitter. I will definitely check it out.

    Report


  6. This is an interesting idea that is for sure it sounds like a easier going version of twitter. Wonder if we can get a plugin in the future to auto post cotnent to Mastodon like we do with Twitter :p

    Report

Comments are closed.