September 6, 2006

How to control the number of posts in label pages

Blogger defaults to 20 posts per page in label pages and provides a link called "Older posts" to view other posts. If you are using my hack to display only the page titles in these pages, you will agree that the display is too short and we could show many more posts. Michael identified this possible improvement and I thought it's a good idea. I found that the parameter that controls the number of posts is "max-results". For example, the URL "http://hackosphere.blogspot.com/search/label/beta%20hacks?max-results=100" will show a maximum of 100 posts with the specified label.

Here's what you need to do to increase the number of posts. Download your template, save a backup copy and use your editor to replace all occurances of
data:label.url
with
data:label.url + "?max-results=100"

Then, upload your new version and check to see if it works. This will work irrespective of the kind of labels widget you have (Blogger default, drop-down or multi-style version). Also, you could use some other number instead of 100. I thought 100 is a good number but it may not work for you.

Did you check out the section called "Beta hacks from neighborhood" in my sidebar? It has links to some cool hacks from others such as
1. Phydeaux3's Label clouds
2. Vivek's hotlinks to most of the social bookmarking sites and google translate utility.

Update: If you are using label clouds and you want to set max-results, replace this line in Phydeaux3's code
a.href = lcBlogURL+'/search/label/'+encodeURIComponent(t);
with this.
a.href = lcBlogURL+'/search/label/'+encodeURIComponent(t) +'?max-results=100';

32 comments:

Anonymous said...

I stand in awe of your greatness! Thank you for answering my call so quickly. I can't wait to drop it in to my blog at lunch!

Unknown said...

michael, it was easier than expected.

Anonymous said...

Nice trick. I'll be doin' that. Cheers!

me said...

Hi! Good blog yours! I visited it for the first time without know a single thing aboout it presence! However beautiful!
So i'm italian and excusme if my english is a little bad...so i'm writing to you because I have a blog too, invoevoluzione.blogspot.com) it's a little bit newer than yours, i'm not an informatic technician so it has some errors maybe, but i hope someone visit it and i would ask you what i have to do (without pay money) to increase the number of visitors if it is possible.
Thank you a lot man!!!

Sharon Pickering said...

Are there only 3 places to make the changes? Mine doesn't seem to work. (no surprise to me...nothing is working for me today, I have a cold.)

Unknown said...

Annie, that's because you're using a hack from the other camp :) (i.e. label cloud). However, I have a solution for that too. I think you need to change the following line in phydeaux3's code
a.href = lcBlogURL+'/search/label/'+encodeURIComponent(t);
to
a.href = lcBlogURL+'/search/label/'+encodeURIComponent(t) +'?max-results=100';

If it works let me know, i will add this tip to this post.

Sharon Pickering said...

ramani, I like both camps...you both have great hacks! :-)

It worked, thanks for saving a hack from the other camp for me.

I think I need to eat something (a fluffy nutter sounds good) and take a nap. My brain isn't working normal. Might be the cold medicine!

Unknown said...

Annie, I was just kidding. I love phydeaux3's label clouds! I do want my stuff to work with his stuff.

Good that it worked for you. Take care!

Anonymous said...

really nice ... I will try it :D

Anonymous said...

Ramani,

how do you make your comments appear in red? i would like to do this on my blog (with a different color), so my visitors know when it is me that is posting the comment.

Unknown said...

Bravery,

The author comment color is just the start. I will make more changes and then announce it.

Anonymous said...

Can we control the number of words in recent comments?

Unknown said...

Anonymous, i don't see any way to specify the number of words in comment feed and so its not possible.

sereneannabelle said...

thanks for the hack.

i am currently using the classic template and i have discovered that the way to increase the number of posts in each label page is to add

beta%20hacks?max-results=100

after the entire URL representing each label. for example, the label i added for "Shit happens", used to be

< a href="http://goodshithappens.blogspot.com/search/label/Shit%20happens">Shit Happens< /a>, and the label pages showed all my labels after i changed the html to:

< a href="http://goodshithappens.blogspot.com/search/label/Shit%20happens/beta%20hacks?max-results=100">Shit Happens< /a>

Kelly Neuman said...

I would like to know how do you put the adsense into the post in blogger beta? I've tired several different ways but failed, I knew how to in the old version..

Anonymous said...

Nice and easy hack!!!

Jason Leslie Rogers said...

I replaced the code (two places), but it makes my posts and my horizontal label tabs disappear! Help?!?

Unknown said...

Jason, which blog has this problem?

keda said...

hi!

i'm using a classic template and having worked on it and as i am happy with it i don't want to go to the new widgety template thing.

but as i am using the new labels when i click on a label only 20 posts show up as you've posted on.

my problem is that as i have my old template i don't have a link at the bottom for 'older posts'.

all the hacks i have seen are for the new widget thing and it doesn't work in my html.

please please please could you tell me how to put in some kind of link to show older posts in my old html language?

Mélanie said...

Whta is the difference between label and clouds?

They are the same?
I was wondering witch one should i choose:Zoom clouds or your code?

Unknown said...

cammu,

cloud is one form of displaying labels. My multi-style labels is a combo of 3 styles. if you need a label cloud, visit phydeaux3.blogspot.com. I don't know about zoomclouds.

Anonymous said...

"Older posts"
I'll ask you how can we add "Older posts" at end of the page when they click a labels (supposing that it includes more than 20 post). please help me with this because i'd an old blogger account now switched to new blogger. What kind of code we should add to template?

Unknown said...

Doesn't older posts link already appear for labels with more than 20 posts? I thought so.

HL said...

Hello, I followed your instructions to make "Expandable posts with Peekaboo view". It worked. But here is a problem: when I made an expandable post for the same article with several rounds of experiment. The count of the posted articles corresponding to the same "Label" kept on increasing. But actually, the number of the posted articles had been the same. Can you please tell me how to fix the problem.

သစၥာ | သ​စ္စာ said...

I can not go to Bloggeratto because This blog is open to invited readers only
Bloggeratto
http://bloggeratto.blogspot.com/
How I can ....

Avatar X said...

Bloggeratto is in on a downtime.. so you can´t enter now.

-Avatar

Mélanie said...

It's not working for me.
:(

Haree said...

Can you please tell me where to get the tutorial for displaying comments in separate pages, as done here.
Thank you
--

Unknown said...

Haree,

That feature is available only with Neo template which I have stopped offering.

Mélanie said...

YES!
It's working now. I set up to 200 labels instead of 100.
Thank's
:)

Siddharth Varadarajan said...

How can one expand the number of posts displayed with old blogger template? For various reasons I have not migrated. I get to label my posts but when I try and display by label, it only shows a max of 20 posts, and I don't get the link for 'older posts' that I see in some blogs.

Help!

My blog is svaradarajan.blogspot.com

Anymatters said...

thanks for your trick. it's so useful.