Provide a Hugo commenting service

The main problem with static blogs is that we’re limited to external commenting services. As Disqus et al. require the admin to integrate (mostly) giant Javascripts and there is a chance that some day the comments just disappear, maybe a good alternative would be a self-hostable Hugo commenting service? (Of course that would limit the advantages of a static site, but it would improve the usability. Plus, a Hugo-specific commenting service would integrate well into most themes if done correctly.)

Just a thought.

1 Like

There is no way to do this w/o relying on a third party service, over which you still would not have control as it would be a service. Even with a service created just for Hugo, it would still be a third party service. This is the issue with static sites.

As a point of philosophy, don’t seek permanence and don’t seek consistency. These things are unnatural and bring about conflict and only ever conflict within.

Having that said, I’d suggest using a well known commenting service. Either Facebook or Disqus would be best as their comments are not likely to get deleted or removed. If you’re looking for a long term solution for storing comments, I’d suggest the following:

Leave the Hugo virtual host alone (I don’t enable any backend on my static sites)
Create another virtual host in your httpd (apache/nginx).
Enable PHP or another server-side scripting language on this virtual host.
Write a script in that language to accept POST query parameters, sanitize and clean the input, and use bound parameters etc. in your SQL queries to store the comments in a database that you control on your server, which you would be able to replicate or backup.

I might create a service like this, and relesae it in the wild.

It would be three components:

  1. Javascript code to post/retrieve comments using AJAX from the virtualhost/db you setup.
  2. Backend to handle incoming post requests, and get requests for comments/comment ids, etc. in that virtualhost/db
  3. Server hardening, sercurity, spam protection and general InfoSec.

1, and 2, I could provide. A simple one liner to include the Javascript code. A simple server backend script. As for server security and all that, you’d have to handle that.

This also seems like re inventing the wheel, right?

The one important bit in engineering is DRY. Do not repeat yourself. But also, DRO. Don’t Repeat Others.

If someone has made a wheel, and unless you can make a better wheel, with better features, I wouldn’t bother.

I would recommend sticking with a third party service.

As far as I understand, Hugo itself is a massive DRO violation (because there has been quite a huge number of Static Site Generators available for years) so we can softly ignore this rule here, I guess.

However, one of the things with SSGs is that you’re in control. That’s not the case with external comments anymore, Facebook and Disqus (et cetera) don’t leave you in control, neither of the contents nor of the design. (Leaving privacy issues out of the discussion for now.) So something that runs on my server would be a logical option. The existing options which I know of, isso and Hashover, don’t really work as expected and lack features and overall quality. I can see massive potential for a community-driven system here.

I wonder how users feel about signing up to yet another website. I think that most people already are social and use social media services for communication, and if we include their commenting on our blogs, that’s good also for social SEO. If one has them on one’s own website, then SEO tends to become 10x more tedious.

As for privacy concerns you have expressed, I don’t think that a system like this would still make any difference.

Rule #1: There is no privacy.
Rule #2: See rule #1.


EDIT: Making a commenting system is fairly trivial. What kind of specific controls do you seek?

As for not having design control, the services need to ensure that their look is readily identifiable, so they need to keep a consistent and look and feel for their socially available plugins. That’s one way of thought.

It doesn’t have to be sophisticated. Commenting, editing/deleting for the admin, maybe mail notification for replies. I guess that’s rather easy (but I don’t speak any Go yet).

The theming issue would be smaller if the system comes as a part of the Hugo ecosystem, because it wouldn’t have to take so many different environments into consideration.

AfAICT, this isn’t something that Hugo would handle. It’s a static site generator, not a back-end processing system, and as soon as that is introduced, it stops being a static site generator and your site stops being static.

Which is why I suggested sort of a “companion service”, not an integration into Hugo itself. Disqus is not a static service either.

This doesn’t seem to be a feature that could be implemented in Hugo.

Could you elaborate on how it would be different than any other third party service?

It all boils down to two points:

  1. The other mentioned third-party services are either not self-hosted (Disqus, Facebook) or lack features (isso) or development (Hashover).
  2. Because they are generic, they have a weak integration into Hugo’s theming.

I don’t know how many of you share these thoughts. I just wanted to suggest it. :confused:

I recently converted my blogs from Wordpress to Hugo. I lost comments, of course, in the process.

I wrote a system to solve this problem. A simple include with a HUGO partial to identify the page and include the javascript. The script makes AJAX calls to a back-end in PHP, talking to a sqlite database.

I’ve packaged it, and offer it as a commercial product, but don’t wish to spam here, but it’s working really well on my blogs.

Hello all,

I only saw this thread now, and as a contribution to the discussion (and possily also to help), please see and comment the second part of this post I wrote about Hugo last November, specifically about a “made-for-Hugo” separate comment manager :