Hugo JSON Comments enables self-hosted comments on your Hugo-generated website
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Hugo JSON Comments

Hugo JSON Comments is a little Go program that listens to POST requests. If they match a specific format it processes them and saves them as JSON files into the Hugo source folder.

These files can then read using Hugo's readDir function and looped through. In the loop each of them can be read with the getJSON function. The decoded comment objects can then used to display the comments.

See for a more detailed explanation.

Note: This is still at proof-of-concept level, although I have it in production on my own site.



Typical usage might be:

$ hugojoco -source=/path/to/hugo -touch=.comment -salt=5VpsqeMX6N0IiUw3e0zfPLxDQ9J5CScvW0nQhUUWNfwziPDeDKHLA60LCsmUcsL2jfmIcChZXtnv1NhGOhpRsQ6o9OyUyeU3ZzDBlD6FTGOLInkm8dia3NuaSsPwlct4

This launches hugojoco, which then listens for incoming POST requests until terminated.

With default settings, hugojoco

  • processes comments posted at :8080/comment
  • saves each comment to ./comments directory
  • tries to look for content files in ./content directory
  • uses no salt for hashing email addresses


See hugojoco -h for options.


Sets the source directory of your site. Default: "."


Sets the content directory of your site relative to the source directory. Default: "content"


Sets the comments directory (that is, where the comments are saved) of your site relative to the source directory. Default: "comments"


The salt to use when hashing the email addresses for internal use. This is not intended to make the hash more secure but to make it unique for each site. Default: none


The IP address to use for the server. Default: any address


The port that the server listens to. Default: 8080


The URL path that is used to process comments. Default: /comment


The file to modify when a comment is posted. This may be needed with some watch scripts that detect only modification of existing files, not the creation of new files or directories. This is relative to the source directory. Default: none

Using With nginx

If you are using nginx you can redirect requests to hugojoco with proxy_pass:

location /comment {