I’m on a bit of a roll this week trying to implement more IndieWeb technologies into my blog. Previously, thanks to the the awesome webmentiond I was able to receive webmentions on my posts. While webmentiond can send webmentions manually, I wanted an automated solution. Certainly I’d love for webmentiond to possibly support this in the future…

Enter Pushl!

This little utility can be fed an RSS feed (or even multiple feeds) and send webmentions to URLs it finds in the posts. Super cool!

Pushl setup

The documentation on the Pushl Github page is just about enough to get set up, but could really do with having all of the optional arguments listed - by chance I came across the --help flag and so could work out what did what. In any case, I followed the instructions to get this set up in a virtual environment and use cron to have it scan my sites RSS feed every 5mins for updated entries.

Upon first running I noticed it actually sent out webmentions for older articles I had written, but it saves this into a cache so doesn’t continuously spam targets every 5mins!

For posterity, the optional arguments are:

positional arguments:
  feed_url              A URL for a feed to process

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --cache CACHE_DIR, -c CACHE_DIR
                        Cache storage directory
  -v, --verbosity       increase output verbosity
  -e entry_url [entry_url ...], --entry entry_url [entry_url ...]
                        URLs to entries/pages to index directly
  -s feed_url [feed_url ...], --websub-only feed_url [feed_url ...]
                        URLs/feeds to only send WebSub notifications for
  --timeout TIMEOUT, -t TIMEOUT
                        Connection timeout, in seconds
  --max-connections MAX_CONNECTIONS
                        Maximum number of connections to have open at once
  --max-per-host MAX_PER_HOST
                        Maximum number of connections per host
  --rel-include REL_INCLUDE
                        Comma-separated list of link RELs to include for
                        sending webmentions
  --rel-exclude REL_EXCLUDE
                        Comma-separated list of link RELs to exclude from
                        sending webmentions
  --max-time MAX_TIME, -m MAX_TIME
                        Maximum time (in seconds) to spend on this
  --user-agent USER_AGENT
                        User-agent string to send
  --keepalive           Keep TCP connections alive
  --no-keepalive        Don't keep TCP connections alive
  --archive, -a         Process archive links in the feed per RFC 5005
  --no-archive          Do not process archive links in the feed
  --recurse, -r         Recursively check other discovered feeds
  --no-recurse          Do not recurse into other feeds
  --wayback-machine, -k
                        Request linked-to pages to be stored in the Wayback
                        Machine
  --no-wayback-machine  Disable the Wayback Machine preservation request
  --self-pings          Allow entries to ping other entries on the same domain
  --no-self-pings       Don't allow entries to ping other entries on the same
                        domain
  --dry-run, -n         Only perform a dry run; don't send any pings
  --no-dry-run          Send pings normally

My crontab entry looks like:

*/5 * * * * flock -n $HOME/.pushl-lock $HOME/bin/pushl/pushl --self—pings -rvvc $HOME/.pushl-cache https://cshire.xyz/index.xml
  • The flock -n $HOME/.pushl-lock is, as far as I can make out, to ensure that only one instance of Pushl runs at a time.
  • The $HOME/bin/pushl/pushl is the symlinked version of Push after installing using the instructions on Github.
  • The --self—pings -rvvc $HOME/.pushl-cache options can be seen in the --help file above. The $HOME/.pushl-cache flag is important so that Pushl doesn’t repeat sending the same webmentions out multiple times.
  • The URL at the end is my sites RSS feed.

Once I had my crontab set up Pushl worked its way through my posts on the first run and now my blog can send and receive webmentions!

Brid.gy integration

However, I didn’t want to stop at just sending and receiving webmentions! I wanted to have some form of comments system under blog posts, but had no intention of enabling things like Discus or Commento. I figured that if my posts could be syndicated out to Mastodon, any responses to the Mastodon post could also come back to my blog - enter Brid.gy!

This was easy enough to setup- I just connected my Mastodon instance on the brid.gy website and inserted <a href="https://brid.gy/publish/mastodon"></a> into my Hugo posts template. Unfortunately I ran Pushl pointed at my RSS feed AFTER I had re-built the site with the Brid.gy link added to post pages. Cue EVERY blog post I had written suddenly hitting my Mastodon feed! I had to manually go through and delete the posts- it would be worth it for anyone doing this in the future to run Pushl BEFORE adding Brid.gy support to avoid this issue as the posts will just be cached by Pushl.

Still to do

There are still some steps I would like to take in making syndication to Mastodon optional - the default behaviour when the Brid.gy URL is hardcoded into the post template will be to automatically POSSE the post. It would be good to possibly have the option in Hugo front matter whether the post will be syndicated, with a false taking the Brid.gy link out of the generated page for that post. While I know that this is just a matter of an If-type statement, I’m not a programmer and know almost nothing about Go!

Also, my posts are still not marked up with u-syndicated so I’m not sure how much of a Mastodon conversation would be sent back to my site as webmentions - I guess I’ll have to fiddle around and test. I’m honestly not entirely sure how this is supposed to work anyway - My process is to finish writing a blog post, then build the site and move it to my webserver via SFTP. Pushl will then pick up a new post in my RSS feed and send out webmentions to Brid.gy - I’m not sure how I would add the Mastodon post link to a blog post without waiting for all of this to happen, adding the Mastodon post link manually and then deploying the site. I’m not sure I want to rebuild and move the site to my webserver twice for every post!

Lastly, it would be great if I could get over the issues above I’d like to integrate reply contexts to the site - I have an idea whereby replies, boosts etc on Mastodon can be sent by my site via Brid.gy. Perhaps a template could be made in Hugo using different archetypes and the front matter could be used to define the type of response. This, in turn, could lean on a template to build the appropriate page on site generation. It’s just an idea at the moment and it might be beyond my skill level…but given that Covid-19 cases seem to be rising again it seems I’ve got all summer!