As part of trying to implement a website-first POSSE workflow, I wanted to start with posting Likes to my website and sending out webmentions from them. That is a lot of what I used to tweet out. Why should a record of what I like be stored elsewhere?
It took me a little while to figure out what I wanted this system to look like, but once I landed on it and verified it could work with a couple quick tests, I got to work building it out and it has been running smoothly for a couple of weeks.
Inputs and Outputs
Where do I read content the most and how can I get links from there into my website? This was my research question before Christmas.
When I’m at my computer, posting likes is fairly painless, though it is a multistep process:
- Go to my website
- Log in
- Click to add a new like
- Paste in the URL
- Add commentary
- Click publish
There is more friction on mobile, which is where I tend to read a lot of content.
Jan Boddez pointed out that using Micropub reduces that friction. Unfortunately I couldn’t find clients that reliably worked for me on iOS.
So, that put me back in the realm of looking for solutions. I did what I do on most projects: Look where the inputs are coming from.
- I spend most of my time reading articles on mobile.
- 50% of what I want to post as Likes comes from content already in my RSS feed reader.
- The rest come from a mix of social, email, general browsing (things like news.ycombinator.com, pinboard.in/popular), and Slack groups.
Whatever I choose has to incorporate all of these channels and has to work from all of my devices (macOS, iOS, and iPadOS).
I decided to handle likes coming from the various sources in two ways:
- A solution specifically for my RSS reader
- A solution for everything else
From the RSS Reader
My RSS reader of choice is NetNewsWire (I used it before the Black Pixel era too), and I use Feedbin as my feed syncing service (and the email -> RSS functionality).
Feedbin and NetNewsWire supports stars, so I decided that anything I star in Feedbin should be posted as a Like on my site.
Feedbin has an API that makes starred entries available in two ways:
- As a filter option on the Entries endpoint
- As its own endpoint that returns a list of IDs, which then need a follow-up API call to fetch the contents
I thought about a couple ways of fetching those starred items and turning them into posts. What I landed on is a simple plugin that polls the API once an hour, posts new items as Likes, then saves the IDs of the posts it processed so they won’t be processed again.
This was the first proper WordPress plugin I’ve build and I learned a lot in the process:
- The proper way to set up and tear down dependencies on install and uninstall hooks.
- Working with WP Cron.
- Setting up plugin settings pages and saving options.
The Likes are posted using Jan Boddez’s IndieBlocks plugin context block, which also handles sending out webmentions.
Here is the plugin, free to use or remix:
If I were to remake this from scratch, I’d probably save the post permalinks instead of the post IDs to the database to check. That seems slightly more hardened, and also ensures I’m not posting duplicate Likes if a Feedbin ID ever changes.
An improvement I’d like to make: Add a filter to load the plugin updates from GitHub instead of WP.org with the new Update URI header.
For everything else I decided to piggyback off of a bookmarking solution I use. Bookmarking is pretty fast and shared across all of my devices, so I set up a specific folder called Likes and any time something gets added to that folder it gets turned into a Like.
I currently use Larder.io for my bookmarking, which supports making folder contents accessible via RSS. This is perfect for my use case: No authentication, just fetch a feed and parse it. WordPress was born for this.
Side note: I change bookmarking apps as often as I change email apps. I’ve used Pocket, Instapaper, Raindrop, Evernote web clips, Notion, browser built-in options, etc. I know one day I’m going to migrate everything to Pinboard and then it will live there for the rest of my days. For now, I’m still using Larder.
I made another plugin very similar to the Feedbin one above, except that it fetches and parses an RSS feed with WordPress’s built in fetch_feed function. Like the other plugin, it fetches new posts once an hour and posts new Likes, then saves the permalinks of the posts it processed to the database so it skips those next time.
Since bookmarks can have a description, it optionally outputs a paragraph block after the Like with the description I created. Again it uses Jan Boddez’s IndieBlocks plugin context block.
The main thing I learned working on this version is the default feed cache when you are using
fetch_feed() in WordPress is 12 hours and you can override it with a hook:
Both have been running on my website for a couple weeks now without a hitch. I’ve yet to link Likes and Notes in the nav or on the homepage because I want to redesign how they are output, but I linked them here if you are interested.
Leave a Reply