Enabling Webmention For Comments

· 318 words · 2 minute read

As you may have noticed, I’m in the middle of revamping my blog. It’s now a static site, run via Hugo and Cloudflare Pages. I was planning to use Disqus for comments, but changed my mind when I realised it meant ads and tracking. This led to a search for alternatives which ended in choosing Webmention.

Webmention logo

Let’s start at the beginning. Hugo has inbuilt support for Disqus, and I was part way through setting it up when I realised it wanted to show adverts and the number of people on the internet was complaining about the level of tracking. The Hugo docs list a number of alternatives, but the vast majority of free ones require self-hosting, which I’d just managed to get away from…

A bit more investigation and I stumbled on Webmention. Webmention is an Indieweb solution that’s now a W3C standard. They provide a way to be notified when another site mentions your blog (similar to pingbacks) but can also be used to pick up social media mentions. I spend a lot of time on twitter, so keeping everything on the same platform is pretty useful to me.

Unfortunately, implementing webmention wasn’t as straightforward as I hoped. I needed to use bridgy to scrape Twitter, which sent results to webmention.io, which in turn provided an API for me to query. I used a modified version of webmention.js to have clients pull in the comments. In the future, I will likely have to come up with a caching solution or have a “click to load comments” button to avoid hammering webmention.io.

Overall, I’m pretty happy with this solution, but it does requires readers to have a twitter account (although I think Mastodon and other sites are also supported). If you want to try it out, just write a tweet mentioning the URL of this page, or reply to an existing one. Let me know what you think!


To comment on this article, just tweet including the URL of this page, or respond to an existing tweet. (For more on how this works see enabling webmentions).