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';

No comments yet