Limiting the number of posts in labels page

If you have lots of posts it helps if you can limit the number of posts appearing in a page. It will reduce the page load time and requires less scrolling by your readers. In Blogger, you can limit the number of posts appearing on the home page, but you cannot do so on the labels page.

In this short tutorial I will show you how to put a limit to the number of posts appearing in labels page.

 

1. Changing the code for in-post and Labels gadget labels.

  1. Login to your Blogger account.
  2. Go to Dashboard > Design > Edit HTML.
  3. Back up your template.
  4. Tick the  Expand Widget Templates check box on top right of the HTML window.
  5. Look for following line in your HTML code:
expr:href='data:label.url'

You may find more than one instances. Replace them with the following:

expr:href='data:label.url + "?max-results=5"'

 

2. Changing the code for labels menu tabs

If you use menu tabs to link to label pages, the links you use are probably look like this:

http://YOURBLOGNAME.blogspot.com/search/label/YOURLABEL

to limit the number of posts shown, just append ?max-results=5 to the link, like this:

http://YOURBLOGNAME.blogspot.com/search/label/YOURLABEL?max-results=5

 

The codes above limits the list to 5 posts. (You change the number with your own limit).

Once the code is altered, your label pages will only show 5 posts. To view the next set of 5 posts, just click the Older Posts link at the bottom of the page.

If you would like to reduce the loading time and scrolling yet at the same time show all posts, you may want to opt for Showing title only in archive and label pages.

Enjoy!

47 comments to "Limiting the number of posts in labels page"

Unknown September 21, 2009 at 12:25 PM    

Thanx a lot for this code i really need it! But its not working in my blog

What can I do?

Please please help!

Greenlava September 23, 2009 at 3:37 PM    

Emma,
Apparently the previous code only works for Labels gadget.
I've revised the post to cover in-post labels and menu tabs labels.

Artemisia Moltabocca September 29, 2009 at 5:43 AM    

Thank you. I wondered why my label link "Updated" was showing a default of 20 posts when that label has over 50 posts. I changed it to a maximum of 100 posts and it worked!

Greenlava September 29, 2009 at 11:34 AM    

You're welcome Artemisia.
Browse around for more tips.

Termite information October 6, 2009 at 1:11 PM    

Its can improve our blog speed in loading. Its became much faster with it. These codes are very useful, I thinks that every one needs it. thanks for this valuable info.

Rebecca,  October 16, 2009 at 6:11 AM    

Hi Greenlava.

My blog archive in my sidebar is set up to show daily posts by hierarchy with post titles and the oldest post first.

Some days I have multiple posts, some days just one or two.

Is there a way to limit the number of archived posts that show when a specific date is clicked, kind of like you have shown how to do here with labels (which worked beautifully for me btw)?

Greenlava October 16, 2009 at 7:06 PM    

Rebecca,
You might want to read this this

Rebecca,  October 17, 2009 at 6:28 AM    

Skimming that link, it looks like what I'd like to do is a problem experienced by many. Going back to look closer....

Thanks again Greenlava. You are a tremendous resource and I do appreciate your help.

~Rebecca

Anonymous,  October 19, 2009 at 3:02 PM    

thank u. u've made so easy. that u

JoE C October 22, 2009 at 10:30 AM    

This worked great! Thank you very much.

Greenlava October 22, 2009 at 4:11 PM    

Anonymous, JoE C!,
You're welcome and thank you for stopping by. Don't forget to come back...

Jaunty Quicksand November 1, 2009 at 3:31 AM    

I seem to have a different template. On my dashboard, I do not have a "Layout" tab. I just have "new posts", "edit posts", "settings", "template", and "monetize".

Si cannot find the text you want me to replace.

My issue is this: I made labels for all my posts. Some labels have more than 20 posts. On my main (blog) page when someone clicks on my labels they can only access the last 20 posts that used my labels. The remianing ones do not show up and neither is there an "older posts" link.

IS there any way I can rectify this?
Thanks for your help.

Greenlava November 1, 2009 at 5:56 PM    

Jaunty Quicksand,
You are using a classic Rounders 3 template. This hack is for Layout templates.
I have no idea why you can only access 20 posts for label. As for the "older posts" link, I think classic templates don't have that.
Why don't you upgrade to Layout template? They also have Rounders 3.
If you do want to upgrade:
1. Before you do anything, make sure you copy your existing template HTML and save it in Notepad or some other text editor.
2. Go to Template>Customize Design and click Upgrade Your Template button. The choose your template.
Once upgraded you can then add in Link List, Recent Comments and Label gadgets via Layout>Page Elements>Add A Gadget.
For the Link List I think you have to enter the link one by one -copy and paste from the template HTML you saved in step 1.

Jaunty Quicksand November 2, 2009 at 2:21 AM    

Greenlava,

Thank you so much on multiple levels. First for being so prompt with your response. Second, for provide such crisp and easy-to-follow instructions. Third, for providing a solution for my problem.

Everything worked out just wonderfully. And I feel like I know so much more now.

If you are not already one, then you should seriously consider being a teacher. You have the right attributes to make a good one.

Than you again.
Jaunty

Lucinda November 7, 2009 at 11:28 PM    

Hi, when I click on my label list, it does not show any label associate with that label at all. But I clcik on 'Showing posts with label..' at the end of the post, it can displays all.

Any idea what is wrong?

Thanks

Lucinda

Greenlava November 8, 2009 at 12:17 AM    

Lucinda,
The code for the label link in the label gadget is wrong.
Go to Layout>Page Elements and remove the gadget. After that add a new Label gadget. The new gadget should work.

DhammaMedicine December 22, 2009 at 10:54 AM    

really useful. thanks a lot..

AP,  December 27, 2009 at 3:01 PM    

One Word, Amazing, this trick is very hard to find in the web. Thumbs Up!!! Sovle loading pobem.. Thank

Andrew February 4, 2010 at 9:53 AM    

Thank you!

sandra April 30, 2010 at 8:22 AM    

Thank you very much for the info. It does work great on my blog!
http://www.bellesimagesphotogallery.com/

Have a great day,

Sandra

Greenlava April 30, 2010 at 11:00 AM    

@Sandra Austoni
I'm glad it worked out for you.
I love those Garden shots :)

Anonymous,  July 18, 2010 at 1:03 AM    

Thank you very much, it is working.

Greenlava October 22, 2010 at 11:44 PM    

@Shawn
Change both.
The first one is for labels displayed at post footer or header. The second is from labels inside your Labels gadget.
You want both sets of labels yield the same number of posts.

SMS December 1, 2010 at 3:26 PM    

Thanks...
I didn't do the 2nd step(Changing the code for labels menu tabs) is it ok?

It's working.

Greenlava December 2, 2010 at 9:38 PM    

@SMS
Since you don't have menu tabs that's pointing to labels page, you don't need step 2.

mobile phone blog October 11, 2011 at 7:43 AM    

i always use this now on my blog... look great....

thank you

kawsar October 19, 2011 at 2:42 AM    

thanks alot this helped

Jarviz October 21, 2011 at 12:10 PM    

Sir, Greenlava
You've stop comments in "Creating A Static Page" post. so, I'm a bit awkward here because I wanna ask about posting on second page of blogger. How can i post things on the second page????

Greenlava October 22, 2011 at 3:16 PM    

@Jarviz
You can't add posts to a standalone page. But if you want to list posts of a certain category/label on a "page", you can:
Adding label (category) tabs to navigation bar

Lok Bahadur Thapa December 4, 2011 at 4:41 PM    

it is really helpful and thank you very much...

Lok Bahadur Thapa December 4, 2011 at 4:45 PM    

it is very helpful and thanks a lot...

shree@SOFTECHNOGEEK January 15, 2012 at 5:31 PM    

i just done this thing to my blog thanks

mothered August 26, 2012 at 8:58 PM    

Tried many other codes to no avail. This worked perfectly!

Thank you.

Μαρία October 8, 2012 at 3:04 AM    

Greenlava such a simple but great tip for max-results in menu items. My diary blogger template was looking broken when scrolling down to posts past the 5th one. Thanks to your tip I dont' have to change my template.
Thanks a million :)

Epoca Libera October 25, 2012 at 4:46 AM    

Thank you for this great tip too, Greenlava!
Very useful for my blog, as my template was looking broken when scrolling down to posts past the 5th one, in label search.
After applying your tip, it works smoothly.
Best!

Anonymous,  November 23, 2012 at 7:46 PM    

Thank You Sir. Great Help

Emmanuel Obarhua December 16, 2012 at 5:14 AM    

I want to say thank you. Cos this tutor is all I want.

for details December 18, 2012 at 4:56 PM    

This is great to know about the tremendous increase in number of posts and methods adopted for the same. I am sure this would work for many out there too.

Muhammad Irfan January 19, 2013 at 10:56 PM    

thanks for sharing this awesome information

guri February 7, 2013 at 2:29 PM    

Thanks ! helping me .

Unknown March 23, 2013 at 11:56 PM    

Thanks Dude....

chamal March 31, 2013 at 3:27 PM    

Thank..This post is really helpfull...

www.dasathanews.com April 30, 2013 at 3:16 AM    

Yep...
It is working nicely bro.
Thank you very much for sharing.

Descarca Jocuri Gratis May 29, 2013 at 9:34 PM    

the best place for blogger hacks, fantastic work you guys!!

Immer June 18, 2013 at 12:38 PM    

I do thank for this way, it is very useful, good luck!

Mazedul July 5, 2013 at 3:17 AM    

So easy to complete this task .Good post and please keep sharing that type of post.

Yedi Hery October 3, 2013 at 1:07 PM    

thank you ! it works

Post a Comment

We love to hear from you! Leave us a comment.

To ensure proper display, HTML/XML/Javascript need to be escaped first using this escape tool.