Thursday, 27 March 2008

Change numbers of posts displayed by label

Blogspot already has UI allow our to set the number of posts displayed at main page or displayed by days.

Check this picture below :

But when we click on a label in Label widget, there're many posts displayed.
By default with a blogspot blog, max of posts displayed is 20.
And you need to customize number of posts display by label, do the following :

Go to "Edit HTML" as in picture above. Remember to save your template ( for safety ;) ), and then check the check box "Expand Widget Templates".

Now, press Ctrl+F and find below snippet:

<div class="post-footer-line post-footer-line-2">
<span class="post-labels">
<b:if cond="data:post.labels">
<b:loop values="data:post.labels" var="label">
<a href="data:label.url" rel="tag"><></></a>
<b:if cond="data:label.isLast != "true"">,</b:if>

The snippet above show post's label at (usually) bottom of your post.
Notice the phrase in RED, modify it to customize your posts number displayed:
<a expr:href='data:label.url + "?max-results=3" '
3 is mine, just replace yours.

And, the snippet below is the Label widget:

<b:widget id='Label1' locked='false' title='Labels' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<div class='widget-content'>
<b:loop values='data:labels' var='label'>
<b:if cond='data:blog.url == data:label.url'>
<span expr:dir='data:blog.languageDirection'>
<a expr:dir='data:blog.languageDirection' expr:href='data:label.url'>
<span dir='ltr'>(<data:label.count/>)</span>

<b:include name='quickedit'/>

Change phrase in RED and we done:
expr:href='data:label.url + "?max-results=3" '
Now, test your work and enjoy.
Happy harvest exp.


luzonsavana said...

huhu.. thats a great knowledge...

moongy said...

try using your comments by Name/URL ( choice 3 ) to promote your link, or put under a hyperlink

like this

mr likeable said...

This was nice, I wonder if you know how to change the number of labels displayed once you clicked on them. I have a lot of images and I only display 3 in the main post. how do i only display 3 post once clicked on label?

any idea? thanks

Growyourblog said...

hello mr likeable,
i wonder what's you mean? my post also contains guide for 'only display 3 post once clicked on label'.
let me know if it didnt work for you :)

mr likeable said...

I do not know what I did wrong. I must have read it wrong but this time I tried again. It perfectly worked. Thanks for replying so fast, had to try again to verify that It was nothing wrong with what I did but It ended up being. thanks a a lot. Great site. simple and fast page load

Joomla developer said...

Great work.Nicely presented information in this post, I prefer to read this kind of stuff.Please create more blog and i
need more related to seo.Thank u.

Free Hollywood Movies said...

Thanks for providing most useful information.