Before I reduced the page load time by 2 seconds by removing Blogger Navbar, I had already done for 0.2 seconds by using Blogger comments count.

The comments count shows at the end of posts with other meta-data, such as author, published time, etc. Since migrated to Disqus commenting system, I had been using its get_num_replies.js, which was old script in terms of new count.js in Disqus 2012, if I am correct.

Aside: count.js seems no longer requiring list of URLs of posts.

The script’s response time was fast, only a couple of hundreds milliseconds. However, as I recently axed a lot of stuff from this blog, every bit counts, even for just 200ms.


I sat at my desk with a cup of hot black tea, a long desk, sheets of paper scattered over it, noting a number after another number with mathematical equations and tabular data. Rows and columns spanning like a Sunday edition crossword puzzle.

Proofs and lengthy analysis with extensive side-notes and overwhelming footnotes and references, scientifically proving and directing to one final fate.

The fragrance and warmth ascended in the dark room from the cup, the only light was from the monitor. One number stood out among text and numbers on the screen: 236 ms.

Carefully sipping the tea in a cold December night, it’d calmed me.

“That script has to go,” I told myself.


Okay, none of those above had actually happened.

What happened was I knew it’s okay to remove that script and replace with the Blogger’s comment count as those you see from original Blogger templates.

Why is it okay? Because if you have asked Disqus to synchronize back comments, then the counts should be the same from both systems. Although, discrepancy may be occurred, if you delete comment on one system but forget to do the same on other.

Another tiny thing is, the old script also show “… and # reactions” but the new script doesn’t seem to have that part. Since my blog doesn’t receive many responses, so I don’t know if it’s removed (though there still is an option for enabling reactions in Disqus 2012) or reactions are actually incorporated into comments and as comments. Either way, I don’t really care, comments are much more valuable than tweets to me.

Enough talking, the following diffs are what I did to my code:


diff -r d23a2e8552cb -r 5d2ff6a288ba src/js/yjlv-base.js
--- a/src/js/yjlv-base.js Wed Dec 05 05:57:10 2012 +0800
+++ b/src/js/yjlv-base.js Wed Dec 12 02:44:35 2012 +0800
@@ -76,12 +76,7 @@
return;

// Disqus
- var query = '?';
- $.each($('a[href$=#disqus_thread]'), function (idx, ele) {
- query += 'url' + idx + '=' + encodeURIComponent(ele.href) + '&';
- });
$.ajaxSetup({cache: true});
- $.getScript('http://disqus.com/forums/yjlv/get_num_replies.js' + query);
// If visitors are led to comments, then load comments automatically.
var href = document.location.href;
if ( href.indexOf('#disqus_thread') >= 0

I removed the old script loading since it’s no longer needed.


diff -r c7fe5d35707d -r d8c62a8d946d 3803541356848955053-blog.xml
--- a/3803541356848955053-blog.xml Mon Dec 10 11:02:57 2012 +0800
+++ b/3803541356848955053-blog.xml Wed Dec 12 02:43:47 2012 +0800
@@ -15,7 +15,7 @@
<b:skin><![CDATA[]]></b:skin>
<link href='http://fonts.googleapis.com/css?family=Cardo|Prociono|Special+Elite|Source+Code+Pro' rel='stylesheet' type='text/css'/>
<link href='http://www.yjl.im/css/yjlv.css?2012-12-04T21:57:46Z' rel='stylesheet'/>
- <script src='http://www.yjl.im/js/yjlv.js?2012-12-01T09:57:23Z'/>
+ <script src='http://www.yjl.im/js/yjlv.js?2012-12-11T18:03:19Z'/>
</head>
<body>
<b:section class='navbar' id='navbar' maxwidgets='1' showaddelement='no'>
@@ -446,7 +446,9 @@
<b:if cond='data:blog.pageType != &quot;static_page&quot;'>
<b:if cond='data:post.allowComments'>
<span class='post-comments-count'>
- <a expr:href='data:post.url + &quot;#disqus_thread&quot;'>Comments</a>
+ <a class='comment-link' expr:href='data:post.url + &quot;#disqus_thread&quot;'>
+ <b:if cond='data:post.numComments == 1'>1 <data:top.commentLabel/><b:else/><data:post.numComments/> <data:top.commentLabelPlural/></b:if>
+ </a>
</span>
</b:if>
</b:if>
@@ -470,7 +472,7 @@
<b:if cond='data:blog.pageType != &quot;archive&quot;'>
<b:if cond='data:post.allowComments'>
<section id='post-comments'>
- <h2><a expr:href='data:post.url + &quot;#disqus_thread&quot;'>Comments</a></h2>
+ <h2><a expr:href='data:post.url + &quot;#disqus_thread&quot;'><data:post.commentLabelFull/></a></h2>
<div id='comment-notice'>
Please keep your comments relevant to this post and try not to comment something like only &#8220;Thanks&#8221; in entire comment, use the <span style='color:#FFBF00;font-size:26px;'>&#9733;</span> of Disqus to vote up, instead. You can use <a href='http://docs.disqus.com/help/19/'>some HTML tags</a> if you like.
</div>

I replaced with original template’s code for comments count with trivial modifications for my template.

The Blogger’s comments count comes with HTML, it’s in HTML already, static not dynamically retrieved via API, therefore no element/content manipulation. It’s definitely faster.