Friendly Ghost

english, ghost, disqus, comments

Enable Comments On Ghost With Disqus

Posted by Christoph Voigt on .
Featured

english, ghost, disqus, comments

Enable Comments On Ghost With Disqus

Posted by Christoph Voigt on .

The following article gives a step by step explanation to enable Disqus comments in your Ghost blog.
featureimage

1. Create your Disqus account

At first you have to create a Disqus account and register your website. You also have to choose a site short name, which Disqus uses to allocate your website.

2. Insert the snippet

Copy this snippet to your post.hbs, and paste it between {{/post}} and </article>. The file is located in your current theme's directory (e.g. [YourGhostDir]/content/themes/casper/):

Disqus Snippet

Insert this snippet into your post.hbs

Please make sure to change var disqus_shortname = 'example'; to your own Disqus site short name. In the end the whole post.hbs should look like this.

3. Configuration Variables

This snippet slightly differs from the by Disqus provided snippet. It uses a custom identifier - in this case its the ID of your blog post. I highly recommend to use a custom identifier. Otherwise Disqus will use the current page URL per default, which may cause problems hence the URL is no appropriate identifier.

See the following example: http://www.exampleblog.com/great-post/ aswell as http://exampleblog.com/great-post/ may lead to the same article. Hence Disqus maps your comments by your URL you will get two different comment threads. When you tell Disqus to map your comments by a more unique identifier like the blog post ID you avoid this problem.

Disqus provides further configuration variables. By now I found no need to configure them, hence the default value is just working well.

4. Restart Ghost

Keep in mind, that you have to restart Ghost to see your changes (except you are using Forever or similar tools).

Done. You are ready to use Disqus comments on your blog.

Credits

This post is inspired by a thread I found in the Ghost forum. Unfortunately the identifier problem found no attention.

Update

  • Meanwhile there is an official documentation from Disqus available (Thanks Daniel.
  • ryexley recommends to consider to use the uuid instead of the id as identifier. Disqus recommends the id. In fact it should make no difference. Just do it consistently :)