Showing posts with label Change numbers of posts display by label. Show all posts
Showing posts with label Change numbers of posts display by label. Show all posts

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">
<data:postlabelslabel>
<b:loop values="data:post.labels" var="label">
<a href="data:label.url" rel="tag"><data:label.name></data:label.name></a>
<b:if cond="data:label.isLast != "true"">,</b:if>
</b:loop>
</data:postlabelslabel>
</b:if></span>
</div>


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'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>
<ul>
<b:loop values='data:labels' var='label'>
<li>
<b:if cond='data:blog.url == data:label.url'>
<span expr:dir='data:blog.languageDirection'>
<data:label.name/>
</span>
<b:else/>
<a expr:dir='data:blog.languageDirection' expr:href='data:label.url'>
<data:label.name/>
</a>
</b:if>
<span dir='ltr'>(<data:label.count/>)</span>
</li>
</b:loop>
</ul>

<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>

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