a day ago
- The author removed Disqus comments from their blog because Disqus ended its free ad-free option, making it not worth the cost for low usage.
- They replaced Disqus with a system that pulls comments from Mastodon, leveraging the overlap between Mastodon users and their blog readers.
- The solution uses Mastodon's public API to fetch comments as JSON without authentication, then JavaScript parses the data and builds the comment HTML.
- The Mastodon post ID is embedded in the static HTML via a placeholder that gets replaced during site generation using a shell script.
- Comments are loaded on user click (not on page load) to reduce server load, and the function fetch() retrieves the JSON from the API endpoint.
- Each comment displays the user's avatar, display name, account name, content (already HTML-encoded), and media attachments as simple links with emoji icons.
- A blacklist feature allows filtering out specific comments or accounts by storing IDs in an environment variable, which is converted to a JavaScript Set for filtering.
- The deployment process involves a chicken-and-egg problem: the blog must be live before linking from Mastodon, then the post ID is used to rebuild and redeploy the blog entry.
- This is the first post using the new comment system, so the author is testing it for breakages.