By default, the 20 most recent posts are displayed on label pages (ie: when you click on a label link in the sidebar. If there are more than 20 posts assigned to a label, then at the bottom of the page you would also find links to next and previous pages.
Recently a reader asked how it is possible to change this, particularly in regard to label clouds. So in this post, I will explain the methods for changing the number of posts displayed, for both default label lists and label clouds too.
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
To change the number of posts shown on label pages involves editing your template and adding some code which controls the number of posts displayed. It is always good practice to make a full back up of your blog template before making any modifications to the template, so be sure to have done this before implementing this hack!
The process is different depending on whether you use a default label list or a label cloud to display your labels, so I will explain each of these separately for you.For default label "lists"
By "label lists" I refer to the default label widget which is generated when you add a label widget to your blog in the layouts section of your dashboard. This may be a regular list, drop down list or multi-styled version.
Decide on the number of posts you would like to be displayed in your label pages, whether this be 5 posts or 100 (see below for more details about this). Then ensure you have ticked the "expand widget templates" box. You then need to replace every occurrence of this phrase:
data:label.urlWith this instead:
data:label.url + "?max-results=n"where "n" is the number of posts you would like to display on label pages. An easy way to search for all these phrases is to key CTRL+F. You may also like to copy all of the expanded template to Notepad (or your favorite text editor) and change these phrases using the "replace" function instead. Then you would need to paste the modified template over the existing template.
Once you've done this, save your template and click on a label to see the change in the number of posts which are displayed.
For Label Cloud users.
By "Label Clouds" I refer to the hack developed by Phydeaux to display your labels in cloud form. You can read about this hack in this post, and will often find label clouds in my templates.
To change the number of posts displayed when readers click on an item in your label cloud, find this line in your template:
a.href = lcBlogURL+'/search/label/'+encodeURIComponent(t);
And replace it with this instead:
a.href = lcBlogURL+'/search/label/'+encodeURIComponent(t) +'?max-results=n';
where "n" is the number of posts you would like to be shown on labels pages. This section of code will usually appear in the section for the label widget code in your sidebar.
Save your template, and then click on an item in your label cloud to see the change in the number of items.
If you would also like the same number of posts to appear when you click on a label link from your post (usually found in the post-footer section), you would also need to replace all occurrences of "data:label.url" as described above.
Why you may want to change the number of posts displayed.
If you write particularly long posts, you may prefer to have fewer than 20 posts displayed on label pages which would speed up page loading time slightly, and also ensure the pages are not too long.
Those who use hacks to summarize their posts on the main pages (eg: the selective expandable posts hack) may wish to display more posts than 20 to fill up more space on the page instead.
Technorati Tags: blogger+labels | label+clouds | posts+displayed
0 comments:
Post a Comment