Adding Disqus Comments to Ghost
Here’s how I added Disqus to Ghost’s Casper theme. In the post template (post.hbs
), look for
{{!--
<section class="post-full-comments">
If you want to embed comments, this is a good place to do it!
</section>
--}}
and change it to
<section class="post-full-comments">
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = '{{url absolute="true"}}'; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = 'ghost-{{comment_id}}'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://your-short-code.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
</section>
making sure to replace your-short-code
with your actual short code.
Then find the line
{{/contentFor}}
and add the disqus count script line above it, like:
<script id="dsq-count-scr" src="//your-short-code.disqus.com/count.js" async></script>
{{/contentFor}}
again, replacing your-short-code
with your actual short code.