Social Distancing Part 5 - IndieWeb, Inside Out
Kind of stuck at this point, I started thinking, ‘there’s got to be an easier way’. It turns out1 I already knew what needed to be done. However, as Jekyll is kind of the OG of static site generators, getting this kind of IndieWeb functionally (specifically, POSSE) into the site required a bit of additional finesse.
Why Don’t We Do It (on the Server)?
At first, I tried IFTTT. This was by far the easiest to set up. Just provide the URL of a feed to an applet and it will tweet new items on your behalf as they get added to the site. It does the job, and the results are nicely formatted, but it’s the equivalent of a black box. If IFTTT changes how applets talk to services or the developer who made it loses interest, there’s no guarantee it will continue working.2
Enter Bridgy, a service I remember reading about a while back but hadn’t looked at in a serious way for some time. From the site’s FAQ:
Bridgy periodically checks social networks for responses to your posts and links to your web site and sends them back to your site as webmentions. Bridgy also translates the responses to microformats so that your web site can fetch and parse them. Bridgy can also publish posts, comments, likes, and retweets from your web site to social networks. When you ask Bridgy to publish a post, it analyzes its microformats data and publishes it using the social network APIs.
This means I can add a webmention3 endpoint to my post template and when it is published, Bridgy will hit the Twitter API and send a tweet for me. I had previously set up - but never actually used - a separate Twitter account for this purpose - an idea I got from Casey Liss’ engine, Camel. However, I’ve found that implementing micropub style posting (think Twitter, or for the more technically inclined, Mastodon or Micro.blog) is easier if it all uses the same account.
While this is a good start, it’s not finished yet. The web interface to Bridgy gives you a POST request that will actually send the webmention, but for some reason, although I included the Twitter URL - from Bridgy - in my template, a tweet containing a link back to my post wasn’t showing up when I first tried to use this setup. As a result, there’s a tiny script - called
webmention.sh - which uses curl to talk to Bridgy, which goes and pings Twitter.
Ideally, I would like to automate this step, which would allow me to re-enable autopublishing in Netlify. At that point, all that would be required to tweet new items from the feed would be a
git push. Webmention.app seems like the best option for my purposes and I’ve done some testing with it for a few days. It integrates with Netlify’s webhooks feature so I can send a webmention automatically when each deploy succeeds.4
It would also mean I don’t need to hand-edit my script to add the URL of each new post. I just need to figure out how the POST request should be formatted and it should be ready to go.
Another argument in favor of, ‘If you want something done, do it yourself.’⏎
Aaron Parecki’s session from IndieWebCamp last year is a great place to start if you want to get an overview of what webmentions are and how to use them.⏎
Remy Sharp, who runs the service, along with users in the Netlify Community forum have been remarkably patient to answer silly questions from me as they come up, which has been helpful as I try to get this working right.⏎