Dan ([info]danguyf) wrote,

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

  • 19 comments

Anonymous

April 20 2009, 06:42:12 UTC 3 years ago

Nice! - From Quite Random

Thanks a lot for this, I was going to work on it... but lately I haven't had time. Thanks!

[info]arhyalon

April 20 2009, 14:55:22 UTC 3 years ago

Moving quickly down my flist, I always read danguyf as Dan Guy Elf.

[info]sweetnsassygirls.com

May 2 2009, 16:05:18 UTC 3 years ago

Unfortunately this doesn't work for me, nor for a lot of my friends. All it does is take away the numbers completely.

[info]danguyf

May 3 2009, 02:26:17 UTC 3 years ago

Looking at your blog, I don't see any reason why it shouldn't work for you. I'm sorry that it hasn't. If you put the code block in again and comment it out, I could take another look to see if you had everything set up correctly.

[info]rainy_janie

July 1 2009, 03:36:54 UTC 2 years ago

well hello stranger how are you?

[info]danguyf

July 1 2009, 22:02:55 UTC 2 years ago

I am well. And you?

Anonymous

February 16 2010, 04:18:52 UTC 2 years ago

display more than 200 comments

I am going to try this code soon, but first, I have a different problem. I can't see any of the comments beyond #200 - do you have any idea how to fix this? It's quite annoying when the winner of a contest is #359! :)

Thanks, Julie
julie dot biljardt at gmail dot com

[info]danguyf

February 16 2010, 11:35:49 UTC 2 years ago

Re: display more than 200 comments

You would have to provide your blog URL for me to be able to diagnose anything.

Anonymous

March 3 2010, 02:12:07 UTC 2 years ago

I can't number comments in blogger

My blog id is robinhoodsoftwares.blogspot.com

Help me in putting number to my blog comments......

Anonymous

March 3 2010, 12:10:22 UTC 2 years ago

Re: I can't number comments in blogger

Did you read the linked page above? It explains how to edit your blog template to add numbered comments.

Anonymous

July 3 2010, 04:22:27 UTC 1 year ago

Re: I can't number comments in blogger

follow this tutorial it is way easier
http://www.bloggersentral.com/2009/07/numbering-comments-in-blogger.html

Removed Numbering

Your script didn't work for me either and also removed numbering completely :(

Anonymous

April 4 2010, 08:00:47 UTC 2 years ago

This didn't work for me either. I had fixed my blog so that the comments were numbered but it did reset at 201..tried to do the cut and replace the line above but it removed the numbers completely.

[info]hobomama.com

May 13 2010, 04:58:29 UTC 2 years ago

It's not working for me, either

Unfortunately, it's just removing numbers altogether on mine as well. Witness here:

http://www.hobomamareviews.com/2010/04/giveaway-melissa-doug-wooden-puzzle.html

Thanks for your help!

[info]danguyf

May 13 2010, 10:13:50 UTC 2 years ago

Re: It's not working for me, either

Hi! Nice site.

It appears that the block of code that I gave above is not present in your code, so CommentsCounter is never initialized. You have removed the proper line, but not replaced it with the given code as directed. Once you do that, numbers should appear on all entries with proper pagination.

Anonymous

May 31 2010, 03:37:45 UTC 1 year ago

My #'s disappear

When I replace the coding the numbers disappear completely for me as well. Right now I have the #s on there using this tut: http://1stfloorflatcomputery.blogspot.com/2009/11/how-to-number-your-comments.html

I am going to assume the numbers are only going to go to 200 since I couldn't get your coding to work for me. Anyway you can help me? Thanks so much!

My blog is here: http://fabulousfamilyreviews.blogspot.com/2010/05/extra-entries-for-gdiapers-giveaway.html

[info]livingononeincome.blogspot.com

July 3 2010, 03:08:17 UTC 1 year ago

All the numbers are gone after I replace it

Hi I am fixing this for a friend on her blog.
I have administration pridvilage so I can edit all the html.
I follow the instructions below but the numbers are gone.
Can I get some help? Pretty Please...
Here is link of her site with many comments:
http://livingononeincome.blogspot.com/2010/06/60-csn-stores-gift-code-giveaway.html
Thank you very much!!

Anonymous

July 3 2010, 04:21:07 UTC 1 year ago

Re: All the numbers are gone after I replace it

Never mind I found another tutorial!!!
Thanks!!!
Here is the other tutorial
http://www.bloggersentral.com/2009/07/numbering-comments-in-blogger.html

Anonymous

April 13 2011, 07:28:57 UTC 1 year ago

Can't wait to get involved

Hey - I am really glad to find this. Good job!
Create an Account
Forgot your login or password?
Facebook Twitter More login options
English • Español • Deutsch • Русский…