In the footer of your theme (something like footer.ejs
) you should add Disqus script:
<% if (config.disqus_shortname){ %>
<script>
var disqus_shortname = '<%= config.disqus_shortname %>';
<% if (page.permalink){ %>
var disqus_url = '<%= config.url +"/"+ page.path %>';
<% } %>
(function(){
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<% } %>
Don't forget that Hexo is prepared to use Disqus, so you the another missing thing is to enable it in your _config.yml
# Disqus
disqus_shortname: username
How would I get just the comment count number?