Since I moved from Wordpress to Jekyll back in 2012, having comments in my site has been a lost battle to me. For some time I enabled a third party provider (Disqus) but that feeling of leaving my readers content to a provider I did not control was too much of a burden to me and I ended up removing completely any chance for commenting on my site for a very long time.
Webmentions on the other hand has been a W3C standard since 2017. They are not super popular and yet, I’ve seen them many times so finally I decided to take a look and how would it be to implement it in my website.
Some weeks ago Christian’s excellent post came to my attention and the process he unraveled seemed approachable to me so I decided to give it a try.
The steps are pretty much as he explained in his post:
- Add the appropriate metadata to my website to allow to log into a few indieweb services, most relevantly webmention.io, the provider I’ve decided to act as my backend.
- Add the appropriate markup to my Hugo theme template to enrich it with microformats so my posts can be parsed correctly. This includes the syndication tag for every post I link to a Mastodon thread.
- Start converting reactions to my Mastodon posts into webmentions with https://brid.gy. This is going to be my main source of interactions, I think.
- Extend my Hugo theme template to allow me to refer to posts I reply (like this one) so I can generate webmentions easily.
- Adapted the code shared by Bryce Wray on his series about this topic to run a local process that gathers the webmentions into a data folder (one file per post) so I can render them at build time.
I know this seems a bit too convoluted. But for me the benefits are very clear: First, I allow anyone on the Internet to interact with my content in an open and decentralized way. And secondly, I collect all those interactions as data that is then added to my posts at build time.
- I can’t load dynamically the mentions in a post with something like webmention.js. That is technical reason for the approach mentioned above of downloading the content locally and pushing it to my website source code base.
- I can’t load external avatars for the folks that react to my website. Not a big deal, and I could eventually cache those locally somehow, but I haven’t spent time on that yet.
Anyways, are you running a blog or site with a static generator and using a different approach to collect and render comments? Have you considered adding webmention support?