Hi bloggy readers,
Do you know that in the default mode, the label tag widget in our blog can only show you about 20 posts in the first page when being clicked. And then, if we want to see the older posts with the same label, we must click the "Older Posts" link on the bottom.
For example, if we've already set 30 posts using the same label tag titled "sport", it means every time we click at the label tag "sport", it will generate only 20 of the last posts in our blog. The fact is, more than 20 posts in our blog have been set with the same label tag "sport". But, there is nothing we can do except to press the older posts link to list the remaining posts in the next page.
Now, to solve that kind of problem, there is one trick that will allow us to show more than 20 posts in the same first page without pressing the older post link. And that is by using the trick below which involves the editing of our blog template in the Edit HTML and also using a different form of normal link.
Anyway, i separate this tutorial in 2 phases. The first phase is required if your blog haven't been added with the label tag widget. Otherwise, if you already add the label tag widget in your blog, you can proceed to the second phase without following the first phase.
Adding label tag widget to our blog
1. Log in to Blogger Account
Head on to Blogger.com and enter to the Dashboard.
2. Go to Layout
In Dashboard, pick any of your blog and press the Layout/Design button, and then go straight to the Page Element.
3. Pick the place for the Label Widget
In the Page Element, now choose the best position for the label widget.
4. Press the Add a Gadget link
After finding the best position for your label tag, now press Add a Gadget in the area you've chosen. In the provided widgets, scroll down little bit and find the label tag widget called Labels.
5. Save the Change
Now save the change and proceed to the next phase.
1. Go to Edit HTML
Still in the Page Element, now switch the sub-tab to Edit HTML to begin editing the whole code of your blog template.
Before any modification being done in your blog template, it's a great decision to save your current template.
2. Give a tick at the Expand Template widget box.
And then, press the small box called Expand Widget Templates in the Edit HTML page.
3. Find the code
Finished generating the whole widget codes in your blog, now press CTRL + F and find the code below:
After that line, scroll down little bit and locate the code below:
<li>
<b:if cond='data:blog.url == data:label.url'>
<data:label.name/>
<b:else/>
<a expr:href='data:label.url'><data:label.name/></a>
</b:if>
(<data:label.count/>)
</li>
</b:loop>
4. Replace the Code
Now from the line code <b:loop values='data:labels' var='label'> until </b:loop> above, block it with mouse cursor, and then replace it using the code below:
var labelnum = 0;
<b:loop values='data:labels' var='label'>
if (<data:label.count/> > 2) {
document.write("<li><a expr:href='data:label.url + "?max-results=5"'
rel='nofollow'><span><data:label.name/></span></a> (<data:label.count/>)</li>");
} </b:loop>
</script>
5. Save the Template
By pressing the Save Template button you can save the current changes you've just made. As you can see in the result, if you press one of the labels in the label tag widget, you will be automatically brought to the new page contains all of the results without entering to the second result page.
The configuration of the label tag widget
Anyway, if you want to set the specific amount of posts that you want to show in the label result page, you can simply edit the code below with a specific value. Now take a look at the code below:
var labelnum = 0;
<b:loop values='data:labels' var='label'>
if (<data:label.count/> > 2) {
document.write("<li><a expr:href='data:label.url + "?max-results=5"'
rel='nofollow'><span><data:label.name/></span></a> (<data:label.count/>)</li>");
} </b:loop>
</script>
As you can see in the code above, i've already marked with the red. Now try to change the value max-results=5 to the higher value with your own preference. For example, change the value 5 to 10 if you want the label tag to generate you 10 posts in the label result page. So the new edited code should now look like this:
var labelnum = 0;
<b:loop values='data:labels' var='label'>
if (<data:label.count/> > 2) {
document.write("<li><a expr:href='data:label.url + "?max-results=10"'
rel='nofollow'><span><data:label.name/></span></a> (<data:label.count/>)</li>");
} </b:loop>
</script>
Good luck bloggy!





0 comments:
Post a Comment