June 6, 2009

How to limit number of posts displayed in label page?

By default, readers can only read the recent 20 posts on a Blogger blog label before clicking on "Older posts" to read the rest in case of this label with more than 20.

If you do not like to see them at the same time you can limit the number of posts for each label by reading the instructions below.

Log in your Dashboard blog, click Layout tab | Edit HTML and check the "Expand Widget Templates" box. Please backup your template before any change. Now, pay attention to the gadget label IDs. If you have only one label on the blog layout, this is a keyword "id='Label1'" for finding it out (Use Ctrl + F to show the search box):

<b:widget id='Label1' locked='false' title='Label Title' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>
<ul>
<b:loop values='data:labels' var='label'>
<li>
<b:if cond='data:blog.url == data:label.url'>
<span expr:dir='data:blog.languageDirection'><data:label.name/></span>
<b:else/>
<a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a>
</b:if>
<span dir='ltr'>(<data:label.count/>)</span>
</li>
</b:loop>
</ul>

<b:include name='quickedit'/>
</div>
</b:includable>


When you have found, add the color code as below:

<b:widget id='Label1' locked='false' title='Labels' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>
<ul>
<b:loop values='data:labels' var='label'>
<li>
<b:if cond='data:blog.url == data:label.url'>
<span expr:dir='data:blog.languageDirection'><data:label.name/></span>
<b:else/>
<a expr:dir='data:blog.languageDirection' expr:href='data:label.url + "?max-results=10"'><data:label.name/></a>
</b:if>
<span dir='ltr'>(<data:label.count/>)</span>
</li>
</b:loop>
</ul>

<b:include name='quickedit'/>
</div>
</b:includable>


The label URLs look like as follow:

http://www.myblogplus.blogspot.com/search/label/General%20tips?max-results=1

6 comments:

Analog designer said...

HI,

I had followed the procedure given above. But i could able to limit my lable tags. Kindly have a look at href="www.techdockets.com" and suggest the procedure plz.

BlogTemplate20 said...

You've just wrote a good tutorial. Nice clear tutorial .. Great job..

Jasmine said...

if u want to limit the number of labels displayed do this:
http://www.blondmobile.com/2009/08/blogger-how-to-reduce-number-of-labels.html

Anonymous said...

after limiting label,the previous next tab gone pls help..http://www.mobilesoftzz.co.cc

Historian said...

Hi Dears,
I followed all the steps as discribed above in order to control the number of posts that appear in the labels but without success, every time it shows on the firs page a diferent number of posts. My blog is http://macedonia-history.blogspot.com.
Could you help me to find where could be a problem in order to solve it.

Thanks in advance
Regards

Post a Comment

Amazon Contextual Product Ads