Sunday, July 26, 2009

How to show only specific number of posts in Labels page for Blogger ?


Whenever you click on any of the labels on the Blogger blog,it displays all the posts made under that label. This is by default in Blogger.

But many Bloggers want to show only specific number of posts on their labels page like 2 or 3 or 4 etc.

Here is a step-by-step guide on how to show only specific number of posts on the labels page in Blogger -

STEP I - First of all install a labels widget on your blog if you haven't installed it yet.(It's available in the "Add Page Element" menu.)

STEP II - Goto - Layout > Edit HTML > Expand Widget Templates.

STEP III - Find this code -
<b:widget id='Label1' locked='false' title='Labels' type='Label'>
The number in red may be other like 2,3 etc. depending upon how many labels widget you have.

STEP IV - Below this widget code,find this -
<a expr:dir='data:blog.languageDirection' expr:href='data:label.url'>
<data:label.name/>
</a>
</b:if>
<span dir='ltr'>(<data:label.count/>)</span>
STEP V - Now replace the above code with this code -
<a expr:dir='data:blog.languageDirection' expr:href='data:label.url + &quot;?max-results=2&quot;'>
<data:label.name/>
<span dir='ltr'>(<data:label.count/>)</span>
</a>
</b:if>
The digit in red denotes the number of posts that are to be shown on the labels page,you can enter number of your choice.

Now Save the Template.

That's it you have successfully added the Blogger hack for showing only specific number of posts in Labels page for Blogger.

Bookmark and Share
Digg this

No comments: