April 19, 2011

How to Limit the Number of Pages in Labels Page

When clicking a label, lots of posts are appeared in one page if you posted a lot with the label. By limiting the number of pages in labels page, the page loading time will be reduced and the scroll thumb will be larger.

In Blogger (Blogspot), the number of pages appearing in your first (home) page can be limited by setting in Dashboard>>Settings>>Formatting, the labels page can't be limited.


Check out following simple steps:

1. Sign-in your Blogger Account

2. Go to Dashboard >> Design >> Edit HTML

3. Backup / Restore current template (use button in top of the showing page). Whenever you changes the HTML template, DO Backup before begin.

4. Check the 'Expand Widget Templates' box (in top-right of the template script box).

5. Using the find function of your browser(in most case, ctrl+F), find following expression. (You can just look up the codes to find it.)
expr:href='data:label.url'

6. Replace that line with following line. 5 means that the number of pages limited by 5. You may change it you want. You may find upper line more than 1 time. Just replace all of them with the following.
expr:href='data:label.url + "?max-results=5"'

YOU DONE.

If you use menu tabs to link to label pages, there is an easier way. Your link may be look like: ([blogname] and [label] is your blog name and label)
http://[blogname].blogspot.com/search/label/[label]

Just appending '?max-results=5', limit the pages showing in one page.
http://[blogname].blogspot.com/search/label/[label]?max-results=5

You can see just 5 pages in Labels Page, if you didn't change the limit number. Next or previous 5 pages will be shown when pressing older-post or newer-post link in pager section in bottom of pages.