Bringing together Mastodon and WordPress

Just today, WordPress.com announced the release of the ActivityPub plugin on their blogs. I don’t use WordPress.com, but it did make me aware of the plugin, so I decided to give it a go.

I have been on Mastodon (the excellent ruby.social instance) since November 4th, 2022. Coming from the bird site was a shock, but in a good way. But it also had its own learning curve, just like when you had to learn about Git coming from a CVS system like Subversion. One is distributed, and one is centralized.

Now, with the ActivityPub plugin, I can publish my WordPress site and posts to a federated profile and have people reply to that on ActivityPub but show up as WordPress comments. It is it’s own feed! This sounded pretty nifty, but my setup wasn’t just plug-and-play and required more configuration than what was addressed in the WordPress.com announcement.

I am on Flywheel as my WordPress host, and it turned out I needed additional redirects in my .htcaccess because my webfinger kept on 404ing in my site health. But Flywheel doesn’t allow direct .htcaccess file access, but I can add redirects through the Flywheel site. My first attempt at adding a redirect didn’t quite work as expected. I got instead a redirect to “https://wp-json//activitypub//1/.0//webfinger?resource=acct:[email protected]”. Which does not work.

Flywheel’s Add Redirect page for a site, this setup turned out to be not the correct regex.

Trying to simplify the redirect and make sure it hits the proper webfinger for ActivityPub (Mastadon)

This worked! So I needed to add into my source redirect ^/.well-known/webfinger(.*)$ and then for my destination /wp-json/activitypub/1.0/webfinger$1. Now you can subscribe to my infrequent posts from my blog, [email protected], or from me as an author (which umm not so many other authors on my website) [email protected].

Best of luck tying your WordPress and Mastodon/ActivityPub together 😁

How to: Mastodon Profile Verification for WordPress Website

Are you part of the twitter migration? Me too! I chose Mastodon as my social app of choice, and ruby.social as my community of choice.

Learning Mastodon takes time, and I am right there with you. There is one thing that I can be assistance with, helping you figure out how to verify your website link in your profile. I am on WordPress, because it is a cool content management system, allows me as a non-frontend dev to have something that looks halfway decent with a minimal amount of work, and well I believe in dogfooding.

Head on over to your Mastodon profile, and click edit profile

Author’s picture with the option to click “Edit profile”

In your Mastodon Profile metadata section, add in your personal website, then Save changes. Notice the Verification section off to the right of the metadata options? Copy your customized verification link.

You can verify yourself as the owner of the links in your profile metadata. For that, the linked website must contain a link back to your Mastodon profile. The link back must have a rel="me" attribute. The text content of the link does not matter. 

Mastodon settings/profile
Mastodon Verification section

Next head to your website and add the link on your site anywhere. For example in a footer/header section where you might have other social links. For my WordPress site, I added a Custom HTML block in my sidebar widget section with my Mastodon profile link.

Screengrab of my default Sidebar section, with the Custom HTML block

To check that everything is correct for verification, check out your page source. As with many things front end, checking on the raw HTML (for us the div tag) is the best way to see what the link actually is using in its metadata. The important part for Mastodon verification is the rel="me" attribute. When I look at my page source, I see that it is there

Page source of christine-seeman.com view in Chrome Developer Tools

That’s it! It might take a bit for your verification to show up on your profile (caching/propagation take time) but you should see that sweet green highlighting eventually to let everyone know that you really do control access to that link.

A new day, a new wordpress theme

I’m not only new to ruby, macOS, but also to WordPress. Since at my new workplace, WordPress is kinda a big thing, I knew that I needed to learn this too. I am still trying to get a handle on themes and how to edit the look and feel of the website. I want to keep it clean, really nothing too fancy is needed but a bonus would be if it actually looked good too. So here’s to using Flywheel’s awesome WordPress hosting, but also being a member of the dashboard team.’

Also started up working through Learn Ruby the Hard Way yesterday evening. So far so good, only issue might be that my home computer is a WindowsOS, and my work is a MacOS. I don’t think it is bad that I learn PowerShell, but probably won’t help my day to day.