Feb 03 2016 0

Adding Disqus comment counts to Entries template

On the entries page I wanted to be able to show the number of comments each post has. Disqus provides functionality for this purpose. See the article Adding comment count links to your home page (Disqus Knowledge Base) for more information about this feature.

Added to footer.html

The string sharedmemorydump should be updated to match your Disqus shortname (the same value you have specified in your Blot dashboard when you have opted to make use of Disqus comments). I am hoping there is a way to make this dynamic (using a tag)…

<script id="dsq-count-scr" src="//sharedmemorydump.disqus.com/count.js" async></script>

Changes to entries.html

The tag {{id}} is a Blot-generated value specific to a post and is also used for Disqus as an identifier for the post (data-disqus-identifier)

<div class="calendar">
    <span class="month">{{#formatDate}}MMM{{/formatDate}}</span>
    <span class="day">{{#formatDate}}D{{/formatDate}}</span>
    <span class="year">{{#formatDate}}YYYY{{/formatDate}}</span>
    <br />
    <span style="color: black"><i class="far fa-comments"></i> <span class="disqus-comment-count" data-disqus-identifier="{{id}}"></span></span>

Also made a change to the styling of the tags

<div style="font-size: 10pt;margin-top: 5px;">
<i class="far fa-tags"></i> {{#tags}}<code><a class="title" href="/tagged/{{slug}}">{{name}}</a></code> {{/tags}}

Changes to entry.html

Since I updated the look-n-feel of the tags in the entries.html template, the same look-n-feel is applied on the template for a single post (entry.html)

<p style="font-size: 10pt;">
    <i class="far fa-tags"></i> {{#tags}}<code><a class="title" href="/tagged/{{slug}}">{{name}}</a></code> {{/tags}}

Previous post
Git(hub) goodies Here are some of git commands I have found useful working with Git(Hub) repositories from the command line. Make current directory into a github
Next post
Update on Disqus comment counts Yesterday I posted an article on how to add Disqus comment and noted I was hoping to find a tag to get the Disqus shortname. I haven’t found the
This blog is powered by Blot