Disqus Alternatives

For an alternative approach, I wrote a small Go program that processes posted comments and saves them as JSON files under the website source directory. The JSON files look like this:

{
  "name":"John Doe",
  "emailMd5":"8eb1b522f60d11fa897de1dc6351b7e8",
  "emailMd5Salted":"a2075be64b31fda2c3c6e5d25923494a",
  "website":"http://www.example.com",
  "avatarType":"gravatar",
  "ipv4Address":"127.0.0.1:64093",
  "pageId":"my-third-post",
  "body":"This is the comment body. \u0026lt;span\u0026gt;HTML is escaped.\u0026lt;/span\u0026gt;",
  "timestamp":"2016-06-05T17:10:33+03:00"
}

Those files are looped through using Hugo’s readDir function and read using the getJSON function. The decoded comment object is then used to display the comment.

I have no idea how well this scales and admittedly it has its shortcomings. The nice thing about it is that it mostly leverages Hugo’s capabilities and you can pretty easily write your own program/script to handle the comments.

If you’re interested in the details see the blog post about it and the (badly written) source on Github.

1 Like