Dan (danguyf) wrote,
Dan
danguyf

Numbered comments in Blogger with pagination

(I'm putting this here just so I can link others to it easily.)

If you google "blogger numbering comments" you soon end up on this page, or one linking to it (or one ripping it off).

It's simple and it works -- mostly. For threads of greater than 200 comments Blogger paginates, at which point the comment numbers start over from 1. But this is easily fixed.

Just replace:
<script type='text/javascript'>var CommentsCounter=0;</script>

with:
<script type='text/javascript'>
<!--
  var regexS = '[\\?&]commentPage=([^&#]*)';
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    var CommentsCounter = 0;
  else
    var CommentsCounter = (results[1] - 1) * 200;
//-->
</script>

Example of it in action.

UPDATE: If you're going to leave a comment complaining that this doesn't work for you, you might at least give the URL of your blog so that I can drop by and help you to fix it. Without proof to the contrary, I'm just going to assume that all of you anonymous commenters are incapable of simple cutting-n-pasting.
  • Post a new comment

    Error

    default userpic
  • 19 comments