How to enable comments in Ghost blogs in 2020?

Sure I can do that. In my theme, I have a partials called “disqus-comment.hbs” which is what takes care of rendering the comments for my particular theme. In casper, this is located in the “ghost_root_directory/content/themes/casper/post.hbs” file. You’re looking for <section class="post-full-comments"> in casper. In my theme, it’s literally called “comments-block”.

You want to do the following code, which is both disqus and facebook comments, encapsulated with the javascript load button:

<div class="comment-container">
    <div class="section-title">
        <span>{{t "Comments"}}</span>
    </div>

<div id="fb-root"></div>
<div class="fb-comments" data-href="https://www.binarycomputer.solutions{{url}}" data-width="100%" data-numposts="5"></div>

<div class="comments-block">
    <button id="show-comments" onclick="disqus();fbcomment();return false;">Display and Interact with Comments</button>
</div>

<div id="disqus_thread"></div>

<script>
var disqus_loaded = false;
var fb_loaded = false;
var disqus_shortname = 'SHORTNAME_HERE'; //Add your shortname here
function disqus() {
    if (!disqus_loaded)  {
        disqus_loaded = true;
        var e = document.createElement("script");
        e.type = "text/javascript";
        e.async = true;
        e.src = "//" + disqus_shortname + ".disqus.com/embed.js";
        (document.getElementsByTagName("head")[0] ||
        document.getElementsByTagName("body")[0])
        .appendChild(e);
        //Hide the button after opening
        document.getElementById("show-comments").style.display = "none";
    }
}
function fbcomment() {
    if (!fb_loaded) {
        fb_loaded = true;
        var e = document.createElement("script");
        e.type = "text/javascript";
        e.async = true;
        e.src = "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2&appId=FACEBOOK_APP_ID&autoLogAppEvents=1";
        (document.getElementsByTagName("head")[0] ||
        document.getElementsByTagName("body")[0])
        .appendChild(e);
        //Hide the button after opening
        document.getElementById("show-comments").style.display = "none";
    }
}


//Opens comments when linked to directly
var hash = window.location.hash.substr(1);
if (hash.length > 8) {
    if (hash.substring(0, 8) == "comment-") {
        disqus();
    }
    if (hash.substring(0,11) == "fb-comments") {
        fbcomment();
    }
}
//Remove this if you don't want to load comments for search engines
if(/bot|google|baidu|bing|msn|duckduckgo|slurp|yandex/i.test(navigator.userAgent)) {
   disqus();
   fbcomment();
}
</script>

In short, what this code is doing is wrapping the default disqus comment handler, as well as the facebook handler provided by facebook, inside a container that’s only loaded if the user clicks on the button, OR it’s a search bot.

To see this in action, check it out: Installing FFmpeg on CentOS without a lot of trouble Scroll to the very bottom, where the comment section is. Hope this helps someone out.

5 Likes

Did you follow any ready-made instructions to host Commento in the same server as Ghost? I am a newbie and would be very interested to know which steps you followed.

Thank you!

Please also have a look at Cove, a commenting tool I built specifically for Ghost recently.

It’s the closest “native” option available: each commenter is a Ghost Member. All your members are contained within your Ghost site rather than having to let commenters sign in with an external profile like Twitter or Facebook.

The aim with Cove is to create a tighter connection between your content and your readers.

1 Like

here are the instructions to follow:

https://imaweb.dev/ghost-3-x-with-commento-self-hosted/

2 Likes

Hi there, I am new here. Interesting thread, thanks for your unswers.

Thank you, being a user, do you know if Commento supports other languages or is it available in English only? I couldn’t find an answer through their website.

Looking at their gitlab repository I believe it is something they are looking to implement soon.

Currently the interface etc is only in English though.

1 Like

I used graphcomment and I like it a lot, it seems to be a nice fully featured system, am not so happy that my users will have to sign up for comments and the main blog separately though.

They can write as guest too.

Cove is a great commenting tool, works like a charm and its minimalistic look is quite beautiful. Highly recommended.

1 Like

Nice!

I am using Hyvor talk.

But Cove doesn’t have a free plan.

Not free, but great.

Does Telegram require a separate sign in on top of Ghost? For my audience on my blog, I am afraid if comments require multiple sign ins, it’s not gonna happen.

If Telegram is not “native” ish on Ghost, what is?

Thanks for sharing!

1 Like

Only Cove can do that.

1 Like

Does anyone have experience with Cove? I see that it requires a subscription. Is it worth the cost?

Welcome to the blogging platform without native feature of comments. That is a long standing "not"problem here. I use discourse, and I am very happy with it :slight_smile:

2 Likes

free plan for developers

Discourse looks great but I can’t really find out where you sign up. The ghost guide is quite lacking and I can’t only find paid versions of it. Any thoughts?