I have a website that uses Disqus for comments. I use a button to hide the comments. The user must click the "2 Comments" button to see the comments:
For blog posts with Zero comments, Disqus loads.
If I try to click a button on a site with comments, nothing happens.
For example - try to click the "2 comments" button. https://john.soban.ski/m30-linux.html#disqus_thread
I use the following code:
<script type="text/javascript">
var disqus = 'freshlex';
var disqus_shortname = 'freshlex';
var disqus_identifier = '/m30-linux.html';
var disqus_url = 'https://john.soban.ski/m30-linux.html';
</script>
<noscript>Please enable JavaScript to view the comments.</noscript>
<section class="post-comments">
<a id="show-disqus" class="post-comments-activate" data-disqus-identifier="/m30-linux.html" >Show Comments</a>
<div id="disqus_thread"></div>
</section>
and
<script type="text/javascript">
var disqus_shortname = 'freshlex';
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
For those of you who have a similar "button doesn't work issue:"
Go to Chrome's Developer tools, look for a red triangle, click it and read the issue
I have a theme that calls highlight.js. I did not load highlight.js and that killed all the following scripts, including my Disqus script.
I needed to add the CDN reference to my web page HTML.
So I added:
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.3/highlight.min.js"></script>
And that fixed it.