Disqus Alternatives

I’m afraid didn’t have much luck with your code

[BTW you’ve missed the closing quote off "Article Title]

I kept getting an error about the markDownContent line:

TypeError: ({title_plain:"Article Title", url:"https://www.example.com/test.html", markDownContent:"<p>Excerpt</p>"}) is not a function.

However by hitting the original Ghost code repeatedly with blunt ignorance, until it stopped screaming, I managed to get that working in a very rudimentary fashion. Here’s what I’ve come up with so far. As you can see, I’ve had to hard-wire a few things in, obliterate a few anonymous function wrappers [?terminology] and also redeclare some vars, as the Ghost code seems to name them differently to what the general.js plugin script is expecting:

{{"<!-- begin nodeBB comments partial //-->" | safeHTML}}
<a id="nodebb-comments"></a>
<script type="text/javascript">
var nbb = {}; //init empty object
console.log("DEBUG: nbb ===> "+nbb);
nbb.url = 'http://localhost:4567'; //nodebb install
console.log("DEBUG: nbb.url ===> "+nbb.url);
nbb.cid = 1;    // OPTIONAL. Forces a Category ID in NodeBB.
                //  Omit it to fallback to specified IDs in the admin panel.
console.log("DEBUG: nbb.cid ===> "+nbb.cid);

nbb.articleID = '{{title .Title}}'; //does Hugo do article IDs? Use title as [hopefully] unique
console.log("DEBUG: nbb.articleID ===> "+nbb.articleID);
nbb.title = '{{title .Title }}';
console.log("DEBUG: nbb.title ===> "+nbb.title);
nbb.tags = []; //array to hold keywords
{{if isset .Params "tags" }}
{{ range .Params.tags }}
nbb.tags.push("{{ lower . }}");
{{ end }}
{{ end }}
console.log("DEBUG: nbb.tags ===> "+nbb.tags);

var articleData = JSON.stringify(nbb); //convert to JSON [even though it doesn't seem to get used in this mess!

//renamed from nbb to nbbjs, as original object is called 'nbb'
var nbbjs = document.createElement('script'); nbbjs.type = 'text/javascript'; nbbjs.async = true;
nbbjs.src = nbb.url + '/plugins/nodebb-plugin-blog-comments/lib/general.js';
console.log("DEBUG: nbbjs.src ===> "+nbbjs.src);

//have to define these again, as they're differently named in general.js
nodeBBURL = nbb.url;
articleID = nbb.articleID;

(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(nbbjs);

<noscript>Please enable JavaScript to view comments</noscript>
{{"<!-- end nodeBB comments partial //-->" | safeHTML}}

That mess of spaghetti gave me the following:

…and the test comment did get placed in the nodeBB forum. Although the thread title and summary post came through as “undefined”. Obviously more var names out of sync between the sample code and the general.js file:

[Oh yes and the CSS got lost too. Hence the ugly black text on black at the top of the posts]

One other problem I ran into was the dreaded CORS error, as Hugo’s server and nodeBB’s are running on different ports:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:4567/comments/get/BBC%20Radio%20On%20Linux/0. (Reason: CORS header 'Access-Control-Allow-Origin' does not match 'undefined').

I got around that by installing the CORS Everywhere plugin in Firefox.

Well, that’s the state of play so far, from this end. The quest continues!

you would need the link to create the forum thread for you […] –and it would also be ideal if the forum threads could be created on demand
you’d also have to write some function to summarise the Hugo post and post that summary as a forum thread.

These are very valid points and I confess I have not thought about them at all. This really complicates the idea a lot… so I guess I will stick to using Disqus. I don’t have the time right now to create complex things so this seems one of the occasions where I have to opt for the easiest option rather than for the best one.

Those two points sound doable. I foresee the real problem arising when it comes to things like accounts and spam-squishing:

  • Submitting a comment would somehow have to create an account in the forum for whoever was commenting. I don’t know if this could be done elegantly, or you’d have to send them to the forum to register first and then come back and post –which would be pretty clunky.

  • Some kind of moderation queue would need to be implemented, to stop the usual spam onslaught.

I don’t either, really. But it’s the kind of thing I’d like to see implemented. I can’t stand Disqus!

So I’ll probably tinker with it in my idle time, on weekends, or whatever. Of course, there’s always the chance some clever bod will take pity on our flounderings and come up with a solution in the meantime.

I am sorry. I took my code example and edited it without testing again.

I had the same problem with “undefined” text but after adding some surrounding tags to the markdownContent it worked (the Chrome JavaScript debugger helped me a lot).

But I am not sure whether I will continue testing it. Having the comments and forum completely on my own server looked promising but for the time being I will stay with Disqus.

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",
  "body":"This is the comment body. \u0026lt;span\u0026gt;HTML is escaped.\u0026lt;/span\u0026gt;",

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

Here are a couple more alternatives to consider:

lambda-comments based on AWS lambda and integrates Askimet for anti-spam

Firebase - here is an article on how to roll your own with Firebase

Has anybody used either of these?

For an opensource alternative, check out https://dyu.github.io/comments/
It supports markdown and is powered by leveldb (easy to self-host)

Another alternative: remark42 (https://github.com/umputun/remark).
Home page: https://remark42.com/

Bonus point: remark42 can import Disqus comments.

Unfortunately, remark42 seems to use Docker which is not very friendly to low-cost VPS hosting.

While lots of people diss Disqus, it is actually pretty good compared to the alternatives. It is very easy to implement and has the major benefit to end users that it is widely implemented and therefore you only need one login for many sites - of course, that also has a potential downside, but as we’ve seen with Facebook, most people even now don’t really care about privacy over convenience.

I’ve yet to see anything that is as easy to implement and free. Though I remain hopeful that one day, someone will crack the problem.

Anything that runs within a Docker container can also run without one. However, the lack of non-Docker installation steps in the readme indicates that it can become quite complicated or cumbersome to install or maintain remark42 without Docker. (Have a look into the Dockerfile to get an idea of the steps required to install remark42 manually.)

To me, Docker is really a convenient way of installing and managing services. Right now I run six services on a 2-core, 2GB VPS that cost me less than 7 EUR/month, and only one of the services is a mem hog due to excessive in-memory caching but this is not a Docker problem.

I agree that Disqus is extemely convenient for the blog owner as well as for the readers. But even if many people don’t give a damn about their privacy, I do care about the privacy of my blog readers. I want to get rid of Disqus as soon as possible, an remark42 looks very promising. (I am also considering Talkyard, which is a forum software that can also work in “blog comment” mode - it has already been mentioned in one or two other threads in this forum.)

Cool. I am in the process of removing many of the things I needed a VPS for in the past so I would be interested in who you are using since my current VPS provider charges more for KVM VPS’s and their current OpenVZ VPS’s have a kernel too old to run Docker.

I’m certainly not disagreeing with you about the potential privacy of Disqus though honestly, I can’t see an issue given how much most of us are prepared to share with Facebook, LinkedIn, Twitter, Google, Microsoft and Apple. As all my comments via Disqus are on open websites anyway and I am always careful what I write since I use my real name, I treat Disqus like I do Twitter.

I use hetzner.de based in Germany. The vServer I am using right now is not available anymore; instead they have a new VPS offer called cloudServer that is even cheaper. If I only had the time to migrate all my stuff over…

Regarding privacy, I agree that many uses do not care, but what about those who do? I don’t want someone refrain from posting a comment just because the commenting system is Disqus.

And besides that, last time I measured load time of my pages, Disqus created a lot of volume, which is not good for slow or metered connections.

So there are already two reasons for looking for an alternative commenting system. A third reason: A self-hosted commenting system means one less dependency on some 3rd-party service.

Thanks, I will definitely add them to my list of possibles.

Certainly not disagreeing with your arguments. All I would add is that the downside to self-hosting is the maintenance overhead and the need to force your commenters to create another login (or use an existing social login which negates the privacy benefit). I regularly find myself not commenting on interesting articles because the site forces me to create yet another login that I will only probably use the once.

Performance not really an issue for me right now since I’ve just moved the blog off Wordpress. So I’m already about a million times faster than I was a couple of months ago :fireworks::tada::grin:

These are indeed all valid points that have to be considered when choosing between service and self-hosting.

One point to add is the GDPR. To date, Disqus has not offered a data processing agreement - neither to the public nor on individual inquiry. If I have no DPA until the 25th I have to disable comments on my blog. Self-hosting is additional effort but it also means less dependency on others.

But yes, self-hosting also has drawbacks. Choosing the right option should be done carefully.

GDPR is certainly a consideration. If Disqus fail to deal with it, I’ll certainly have to reassess.

I would say though that there has been a lot of hype and misinformation over GDPR and it will rapidly calm down over the next few weeks as we see things get clearer. The EU and UK ICO’s have very clearly stated that they don’t intend to aggressively pursue people and organisations that have made reasonable efforts. The legislation also doesn’t totally apply in the same way if you are <250 people in an organisation. Or at least the fines don’t. You will already see a significant split in the way that many organisations - especially those that tend to bombard us with emails - are handling the changes.

Bottom line is that for those of us one man bands writing blogs, there is little to concern us yet as long as we have made some effort. There is also much to come out in the wash before panicking and removing useful tools thereby reducing the usefulness of our sites.

I don’t have time to maintain yet more software just to allow the occasional comment. I’d rather spend time improving my posts and becoming a better communicator.

Thankfully, we have lots of choice for each of us to decide on the priorities, requirements and risks that matter to us.

Useful discussion. Many thanks.

Thank you, too. As a short addendum, now as the 25th has passed by, I am positively surprised about how Disqus have finally addressed GDRP compliance. They deployed a large opt-in banner with three checkboxes, and users only get access after checking at least the first two of them. Well made.

1 Like

Thanks a lot for the update, very helpful & good to know.

I’ve been using Commento for a week now and it seems like the almost perfect replacement.

Here’s what it looks like:

The setup is a little hairy by itself. I greatly simplified it in my tutorial here.

I did look into some other options like schnack and Isso. This type of thing is a personal preference thing sometimes. I recommend you check them out also.

Here’s an overview of various ways to include comments on your static site:

Since there have been a few more comments on this thread. I’d like to recap my requirements for commenting:

  • Must be reasonably GDPR friendly as I’m based in the EU
  • Must have minimal overheads for me as a site maintainer
  • Should avoid the more obvious privacy killing services like Facebook
  • Must include anti-spamming
  • Must have minimal friction for users (otherwise they won’t comment).

This last one is the killer for nearly everything.

I’ve continued to use Disqus and though I don’t get many comments, it is pretty well maintenance free and requires no infrastructure on my side. You can log in with several different types of account if you want to. Users get updates on threads if they chose to without any input from me.