Carl Schwan wrote an article about integrating Mastodon comments on static sites and I loved the idea. Blogs feel a little empty without community feedback, so integrating them with the Fediverse seems like a great fit. Surprisingly no one had packaged this approach into a Hugo plugin yet, which would make this a trivial integration. So that’s what I set out to do.

When I say that “I” am going to do this, I mean I’m having Claude build it. Full disclosure. This plugin is entirely AI built. I’ve reviewed the code as it was built and guided the process, but I wrote next to zero lines of the actual code. This was deliberate, as the second focus of this project, for me, is to exercise various AI development techniques. I know that is distasteful to some, and I very much understand that.

I directed Claude to create the Hugo plugin based on the original blog and it started spinning. The initial version was pretty close to working, but it didn’t handle GoToSocial instances well because those require authentication for API read access. So the next step was creating an auth proxy for the comments. This allows pulling the comments with an access token, but keeping that hidden behind the server. It is a simple small service. It is a bit antithetical to the whole static-site concept, but it is a small compromise.

Usage

The project readme covers this more in depth, but the quick and dirty for installing it is.

1. Install and configure the plugin

Add this to the config.yaml

params:
  activitypub_comments:
    host: social.example.org            # used for display links
    username: you
    proxy: https://comments.example.com # optional, only if deploying the proxy

module:
  imports:
    - path: forge.wynning.tech/james/hugo-ap-comments

2. Fetch the plugin

hugo mod get forge.wynning.tech/james/hugo-ap-comments

3. Add the template

Put this in your layouts/_default/single.html or similar:

{{ partial "activitypub-comments.html" . }}

5. Your posts

Once the plugin is installed, it just requires adding a little front-matter to the post:

comments:
  id: "109774012599031406"    # the status id (quote it — it's a big number)

So this requires a multi step publishing process:

  1. Publish the article
  2. Share on ActivityPub
  3. Add the post ID from ActivityPub instance to the post
  4. Re-publish

Whats next?

If this plugin seems to be useful for others I will likely mirror it to Codeberg or GitHub (if its ever up). I may do it to both anyway just for visibility. If you have any thoughts on how it could be better please let me know!