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 = "{{url absolute='true'}}";  // Replace PAGE_URL with your page's canonical URL variable
    this.page.identifier = "ghost-"; // 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.

This is a preview of Clap Button, a new feedback and analytics tools for Hydejack, built by yours truly. You can try it out on localhost for free, but it will be removed (together with this message) when building with JEKYLL_ENV=production. To use Clap Button on your site, get a subscription
and set clap_button: true in your config file.


© 2021. All rights reserved.