How to Display Comment Counts on Your Site

How to Display Comment Counts on Your Site

Let readers know where discussions are happening
by showing the comment count for articles on your homepage. In this tutorial, I’m going to walk you
through the steps to implement comment counts on your site. For this example, I’ll be using the Disqus
blog. To get started, we will need to add a single
line of JavaScript code to our site’s homepage template. You can copy this from either the Universal
Code installation instructions page in your Disqus Admin or in our Knowledge Base article. Make sure to update the snippet with your
site’s shortname. You can find your shortname in the General
Settings in Disqus. Next up: Paste the code snippet before the

tag in your site’s template. You’ll need to add it to every page where
you want comment counts to appear. On the Disqus Blog, we use Hubspot as our
CMS. We’re going to add the snippet to the Footer
HTML for Blog Listing Pages. Finally, add article links ending in #disqus_thread to your site’s template where you want the counts to appear. This lets Disqus know which article to look
up and return the corresponding comment count. For the Disqus Blog, we’re going to add
the counts beneath the article titles. Let’s check the Disqus blog now. Looks like the comment counts are showing correctly. When readers click the link, they’ll be
able to load the article and jump directly to the discussion. If you’d like to customize the comment count
text, you can do that in the Community Settings. For example, if an article has no comments,
you can change the default text to a call-to-action. This is also useful for translating the text
for your site’s specific language. I hope you found this tutorial helpful. If you’d like to learn how to add comment
counts to non-link elements or use identifiers for generating counts, check out our knowledge
base. Thanks for watching.

Author: Kevin Mason

6 thoughts on “How to Display Comment Counts on Your Site

Leave a Reply

Your email address will not be published. Required fields are marked *