Adding a comment count to your blog with Disqus
Most blog owners that uses the Disqus comments system want to display the comment count for each page with comments, on their home page. Luckily Disqus has built in support for comment count. The setup isn’t difficult, but does require a bit of theme editing.
Add the Disqus comment count script
Find the file of your theme that is responsible for display the Home page of your blog. Depending on your website platform (WordPress, Joomla, Jekyll, and etc) this file may have the name such as home.php
, index.html
, default.html
, or another name.
Then place the following code before the closing </body>
tag in this file:
<script id="dsq-count-scr" src="//EXAMPLE.disqus.com/count.js" async></script>
Note: Change the
EXAMPLE
to ShortName of your Disqus forum. Your ShortName can be found on your forum’sAdmin
→Setup
→ Identity page.
Add the comment count link
Find the place where you want to display the comment count. I chooses a section of post meta-information (section with the date and name of the author). Then place the following code to this place:
<a href="URL#disqus_thread">Comments</a>
Note: Change the
URL
to URL of your post. This will tell Disqus which links to look up so it can return the correct comment count.
And you’re done! Now your posts will have comments counts that will update automatically, and you can style the output the same way you would style any other part of your blog’s theme.
If this article has helped you then please leave a comment
Thanks for reading!
Arthur is a designer and full stack software engineer. He is the founder of Space X-Chimp and the blog My Cyber Universe. His personal website can be found at arthurgareginyan.com.