Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<html>
<head>
<title>Comments count code example</title>
</head>
<body>
<!-- For this link, we will try to fetch comments count by URL: http://example.com/article.html -->
<a href="http://example.com/article.html#disqus_thread">First article</a>
<!-- For this link, we will try to fetch comments count by identifier: article2identifier -->
<a href="http://example.com/article2.html#disqus_thread"
data-disqus-identifier="article2identifier">Second article</a>
<!-- We will ignore this link because its href attribute does not end on #disqus_thread -->
<a href="http://example.com/" data-disqus-identifier="tenthousands">Anchor</a>
<script type="text/javascript">
// This is actual code that needs to be inserted.
var disqus_shortname = 'websiteshortname'; // Put your website's shortname here
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'http://disqus.com/forums/' + disqus_shortname + '/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.