Mastodon Comments for Static Sites

Topics: Jekyll, Static site generator

Replace Disqus with Mastodon-powered comments on a static blog. A web component fetches replies to a toot and renders them as comments. No tracking, no ads, no third-party accounts.

Subtopics

Bookmarks

  • https://jonhnnyweslley.net/blog/mastodon-comments/

How it works

  • Write and publish a blog post
  • Post a toot announcing it
  • Add the toot ID to the post’s frontmatter
  • The web component fetches replies from the Mastodon API and renders them as comments

No JavaScript framework, no cookie banner.

Setup (Hugo example)

  1. Add the mastodon-comments web component (Daniel Pecos Martinez) to assets
  2. Configure Mastodon account in config.yml
  3. Replace comments partial to render when tootId present in frontmatter
  4. On publish: toot → copy ID → add to frontmatter → redeploy

Questions

  • Jekyll — same concept can be adapted for Jekyll/Liquid templates
  • SSG — applicable to any static site generator with frontmatter support