Adding Numbered Page Navigation Bar For Blogger
i’m sure that most of you have a lot of posts and the default blogger
way to navigate between new post and old post is boring. what if your
visitors wants to read for your oldest posts?
should he keep clicking on “older posts”, No.
You should apply this hack for your template, it’s one of the most useful blogger tricks ever.
should he keep clicking on “older posts”, No.
You should apply this hack for your template, it’s one of the most useful blogger tricks ever.
so lets see how to do it.
Caution : Please backup your template (Download Full Template) Before making any changes.
Step 1: Adding The CSS Code.
Log into your blogger account and go to,
Dashboard >> Layout >> Edit html.
And find the following code.
Dashboard >> Layout >> Edit html.
And find the following code.
]]></b:skin> |
and replace it withe
.showpageArea a {
text-decoration:underline;
}
.showpageNum a {
text-decoration:none;
border: 1px solid #cccccc;
margin:0 3px;
padding:3px;
}
.showpageNum a:hover {
border: 1px solid #cccccc;
background-color:#cccccc;
}
.showpagePoint {
color:#333;
text-decoration:none;
border: 1px solid #cccccc;
background: #cccccc;
margin:0 3px;
padding:3px;
}
.showpageOf {
text-decoration:none;
padding:3px;
margin: 0 3px 0 0;
}
.showpage a {
text-decoration:none;
border: 1px solid #cccccc;
padding:3px;
}
.showpage a:hover {
text-decoration:none;
}
.showpageNum a:link,.showpage a:link {
text-decoration:none;
color:#333333;
}
]]></b:skin>
Step 2: Adding The Java Code.
Find the next code Or some similar code
</body>
<!--Page Navigation Starts-->
<b:if cond='data:blog.pageType != "item"'>
<b:if cond='data:blog.pageType != "static_page"'>
<script type='text/javascript'>
var pageCount=5;
var displayPageNum=5;
var upPageWord ='Previous';
var downPageWord ='Next';
</script>
<script src='http://blogergadgets.googlecode.com/files/blogger-page-navi.v1.js' type='text/javascript'/>
</b:if>
</b:if>
<!--Page Navigation Ends -->
</body>
And Click “save template”
In the above code you may only edit four lines to customize your navigation bar.
In the above code you may only edit four lines to customize your navigation bar.
var pageCount=5; |
In this code Number 10 control the number for posts per page, you can change it to choose how many posts per page you want to display.
Note : This Number value should be the same With in your blogger account settingsThe settings can be found by going to Dashboard >> Setting >> Formatting >> Show >> 10 posts
var displayPageNum=6; |
Number 6 here control the number of pages that will be shown in the navigation bar.
var upPageWord ='Previous'; var downPageWord ='Next'; |
if you want to change the language or just change it to any thing, please change Previous for example to Older
Final Step
This blogger trick my cause some problems if you use labels in your
posts and to solve this problems you have to apply the next step for
your template.
1. Add Label Gadget To Your Template by going to Layout >> page elements >> Add Gadget >> Select Labels and add it to your template.
2. go to, Dashboard >> Layout >> Edit html.
And find the following code.
And find the following code.
<a expr:dir=’data:blog.languageDirection’ expr:href=’data:label.url’><data:label.name/></a> |
And replace it with the following code.
<script type='text/javascript'>
var lblname = "<data:label.name/>";
lblname2 = encodeURIComponent(lblname);
var feedlink = '/search/label/' + lblname2+'?&max-results=10';
document.write('<a href="' + feedlink + '">'+lblname+'</a>');
</script>
And Click “save template”
We are done.
Demo.
To see how it looks see this demo blog