Getting Disqus Comments to Work on Your Ghost Blog with Code Injection

Getting Disqus Comments to Work on Your Ghost Blog with Code Injection

I never did get Comments on this here Ghost blog working until… just now.

The documentation isn’t all that… clear. Disqus says this, Ghost says this, this says the same thing, but I’m uncomfortable with single-quoting double-quotes, out of principle.

Everything says you need to edit a file and inject the HTML/javascript, then restart Ghost. I’d wager to assume it’s out of date. Why wouldn’t one just use the code injection feature? This is what I put in the footer:

<!-- *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
*  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/ -->

var disqus_config = function () {
    this.page.url = "{% raw %}{{url absolute='true'}}{% endraw %}";  // Replace PAGE_URL with your page's canonical URL variable
    this.page.identifier = "ghost-{{post.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://andrewaadland-me.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

Just update the s.src variable with your shortname.

Another victory.