Free Information Technology Magazines and eBooks

Monday, April 27, 2009

How to show only specific number of posts in Labels search

Maximum Post for blogger labelsToday I found a bug on my blogger template, the adsense on my right navigation bar is not showing any ads when I click specific Label. I found out that most of my labels contains more than ten posts already. On my blog post section, my adsense between posts was set to display on every 5 posts. This was a problem if the Labels contains more than 10 posts because it will display 3 or more adsense, making my adsense at the right navigation bar empty.

To prevent this, we can set the specific number of posts to be displayed when the user click any label.


Here's the step-by-step instruction to implement maximum posts for labels:

1. Login to your blogger account.
2. Go to Layout>Edit HTML, Make sure to click Expand Widget Templates
3. Find this expression "expr:href='data:label.url" as show below:


<a expr:dir='data:blog.languageDirection' expr:href='data:label.url'>
<data:label.name/>
</a>


4. Now add the max-results parameter. The previous code should now look like this:


<a expr:dir='data:blog.languageDirection' expr:href='data:label.url + &quot;?max-results=10&quot;'>;
<data:label.name/>
</a>



Thank you for reading, if you want to know more about blogger tips and tricks, subscribe now.

0 comments: