Showing posts with label main. Show all posts
Showing posts with label main. Show all posts

Thursday, November 26, 2009

How to add page numbers to Blogger posts

blogger-page-navigation.jpg This script replaces the default blog pager (links to newer, older, and home pages) with numbered page navigation, enabling readers to navigate deeper into the archives with ease, compared to the “newer” and “older” navigation links. Furthermore, it offers the ability to customize the number of page links and the number of posts displayed on each page.

Scroll down to view a demo

1. Login into your Blogger dashboard > Layouts > Edit HTML

2. Insert the following section code below into your template right before the section code: ]]></b:skin>

/*Page Navi Styles start */
.showpageArea a {
text-decoration:underline;
}
.showpageNum a {
border:1px solid #CCCCCC;
margin:0 3px;
padding:3px 7px;
text-decoration:none;
}
.showpageNum a:hover {
background-color:#CCCCCC;
border:1px solid #CCCCCC;
}
.showpagePoint {
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
background:#CCCCCC none repeat scroll 0 0;
border:1px solid #CCCCCC;
color:#333333;
margin:0 3px;
padding:3px 7px;
text-decoration:none;
}
.showpageOf {
margin:0 3px 0 0;
padding:3px 7px;
text-decoration:none;
}
.showpage a {
border:1px solid #CCCCCC;
padding:3px 7px;
text-decoration:none;
}
.showpage a:hover {
text-decoration:none;
}
.showpageNum a:link, .showpage a:link {
color:#333333;
text-decoration:none;
}
/*Page Navi styles end*/

4. Next, you will need navigate over to Layout > Page Elements to “Add a Gadet”. Select HTML/JavaScript and copy and paste the following section code into the box.

<!--Page Navigation Starts-->
<script type="text/javascript">
var pageCount=5;
var displayPageNum=5;
var upPageWord ='Previous';
var downPageWord ='Next';
</script>
<script src="blogger-page-navi.v1.js" type="text/javascript"></script>
<!--Page Navigation Ends—>


Note: The above code references the external .js file "blogger-page-navi.v1.js", which you need to download (right click, and select "Save As").

Configuration

var pageCount is the number of links to display after page 1
var displayPageNum is the number of posts to be displayed on each link
var upPageWord is the previous link (you can change the wording)
var downPageWord the next link (you can change the wording)