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)

Labels: , , ,

8 Comments:

Blogger Hotul said...

This comment has been removed by the author.

December 16, 2009  
Blogger psydex said...

Thanx for the tutorial! It's really useful!
Can you tell me where should i edit the code to change the collor of the text and borders?

January 25, 2010  
Blogger psydex said...

PS: And how to display it ONLY on homepage?

January 25, 2010  
Blogger bdkminang said...

can u detail explain step no 4 i don really understand..

April 02, 2010  
Blogger Syed Manirul Islam said...

Many many Thanks for Usefull Tips shared.I fill I am lucky.
http://downloadbazarbd.blogspot.com

October 19, 2010  
Blogger tzelal said...

very good
thanks
http://www.audiokit.co.cc

February 23, 2011  
Blogger Phillip said...

@Syed Manirul Islam @tzelal - np, nice websites btw. keep up the good work

February 23, 2011  
Blogger Juspache said...

not workin java script link

April 13, 2011  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home