Monday, 28 November 2011

Limit the number of posts on Labels pages in Blogger



1. Changing the code for in-post and Labels widget.

  1. First, login to your Blogger account.
  2. Go to Dashboard --> Design --> Edit HTML.
  3. Remember to always back up your template, as a precaution.
  4. Tick the check box for  Expand Widget Templates on top left of the HTML window.
  5. Look for following line within your HTML code:

expr:href='data:label.url'

You may find more than one instance. Replace each one of them following:
expr:href='data:label.url + "?max-results=5"'

2. Further information, for if you want to change the code for labels menu tabs, in your pages bar at the top of your page
If you use the menu tabs to link to your label pages, you will need to append the links that you use to look like this:
http://EXAMPLEYOURBLOG.blogspot.com/search/label/YOURLABELNAME
in order to limit the number of posts shown when you click a labels link you will need to attach ?max-results=5 to the URL, like so:
http://EXAMPLEYOURBLOGNAME.blogspot.com/search/label/YOURLABELNAME?max-results=5

The HTML code shown above will load up five results if your wish to show more or less simply change the number shown in yellow.

Blog Archive