Page Navigation Hack for Blogger
Most said page navigation menu in the bottom of the page can appear only in WordPress blogs. But Now here is a blogger hack which will help you to show Page Navigation Menu in bottom of the page ( see screenshot ) . you can Add this Page Navigation hack to your blogger template either by inserting script to your template by editing or you can add it as a widget . In this post I will write only how to add this Page navigation menu by editing template code.
I have used a background image for this Page Navigation hack. If you want to show this without the background image just remove the background image url .
Let us start :
Step 1 : Log in to your blogger account and navigate to Layout section. Now go to the edit HTML subtab.
Step 2 : search this line ]]></b:skin> and add this CSS code above that line.
CSS CODE WITH IMAGE :
}
.showpageArea a {border: 1px solid #505050;
color: #000000;font-weight:normal;
padding: 3px 6px !important;
padding: 1px 4px ;margin:0px 4px;
text-decoration: none;
}
.showpageArea a:hover {
font-size:11px;
border: 1px solid #333;
color: #000000;
background-color: #FFFFFF;
}
.showpageNum a {border: 1px solid #505050;
color: #000000;font-weight:normal;
padding: 3px 6px !important;
padding: 1px 4px ;margin:0px 4px;
text-decoration: none;
}
.showpageNum a:hover {
font-size:11px;
border: 1px solid #333;
color: #000000;
background-color: #FFFFFF;
}
.showpagePoint {font-size:11px;
padding: 2px 4px 2px 4px;
margin: 2px;
font-weight: bold;
border: 1px solid #333;
color: #fff;
background-color: #000000;
}
.showpage a:hover {font-size:11px;
border: 1px solid #333;
color: #000000;
background-color: #FFFFFF;
}
.showpageNum a:link,.showpage a:link {
font-size:11px;
padding: 2px 4px 2px 4px;
margin: 2px;
text-decoration: none;
border: 1px solid #0066cc;
color: #0066cc;
background-color: #FFFFFF;}
.showpageNum a:hover {font-size:11px;
border: 1px solid #333;
color: #000000;
background-color: #FFFFFF;
}
It must look like this :

Step 3 : Now search for this code or related in your template ( no need to expand widgets )
<b:section class=’main’ id=’main’ showaddelement=’yes’>
<b:widget id=’Blog1′ locked=’true’ title=’Blog Posts’ type=’Blog’/>
</b:section>
Now Add This script just below the </b:section> .
function showpageCount(json) {
var thisUrl = location.href;
var htmlMap = new Array();
var isFirstPage = thisUrl.substring(thisUrl.length-14,thisUrl.length)==".blogspot.com/";
var isLablePage = thisUrl.indexOf("/search/label/")!=-1;
var isPage = thisUrl.indexOf("/search?updated")!=-1;
var thisLable = isLablePage ? thisUrl.substr(thisUrl.indexOf("/search/label/")+14,thisUrl.length) : "";
thisLable = thisLable.indexOf("?")!=-1 ? thisLable.substr(0,thisLable.indexOf("?")) : thisLable;
var thisNum = 1;
var postNum=1;
var itemCount = 0;
var fFlag = 0;
var eFlag = 0;
var html= '';
var upPageHtml ='';
var downPageHtml ='';
var pageCount=5;
var displayPageNum=3;
var firstPageWord = 'First';
var endPageWord = 'Last';
var upPageWord ='Previous';
var downPageWord ='Next';
var labelHtml = '<span class="showpageNum"><a href="/search/label/'+thisLable+'?&max-results='+pageCount+'">';
for(var i=0, post; post = json.feed.entry[i]; i++) {
var timestamp = post.published.$t.substr(0,10);
var title = post.title.$t;
if(isLablePage){
if(title!=''){
if(post.category){
for(var c=0, post_category; post_category = post.category[c]; c++) {
if(encodeURIComponent(post_category.term)==thisLable){
if(itemCount==0 (itemCount % pageCount ==(pageCount-1))){
if(thisUrl.indexOf(timestamp)!=-1 ){
thisNum = postNum;
}
postNum++;
htmlMap[htmlMap.length] = '/search/label/'+thisLable+'?updated-max='+timestamp+'T00%3A00%3A00%2B08%3A00&max-results='+pageCount;
}
}
}
}//end if(post.category){
itemCount++;
}
}else{
if(title!=''){
if(itemCount==0 (itemCount % pageCount ==(pageCount-1))){
if(thisUrl.indexOf(timestamp)!=-1 ){
thisNum = postNum;
}
if(title!='') postNum++;
htmlMap[htmlMap.length] = '/search?updated-max='+timestamp+'T00%3A00%3A00%2B08%3A00&max-results='+pageCount;
}
}
itemCount++;
}
}
for(var p =0;p< htmlMap.length;p++){
if(p>=(thisNum-displayPageNum-1) && p<(thisNum+displayPageNum)){
if(fFlag ==0 && p == thisNum-2){
if(thisNum==2){
if(isLablePage){
upPageHtml = labelHtml + upPageWord +'</a></span>';
}else{
upPageHtml = '<span class="showpage"><a href="/">'+ upPageWord +'</a></span>';
}
}else{
upPageHtml = '<span class="showpage"><a href="'+htmlMap[p]+'">'+ upPageWord +'</a></span>';
}
fFlag++;
}
if(p==(thisNum-1)){
html += '&nbsp;<span class="showpagePoint"><u>'+thisNum+'</u></span>';
}else{
if(p==0){
if(isLablePage){
html = labelHtml+'1</a></span>';
}else{
html += '<span class="showpageNum"><a href="/">1</a></span>';
}
}else{
html += '<span class="showpageNum"><a href="'+htmlMap[p]+'">'+ (p+1) +' </a></span>
';
}
}
if(eFlag ==0 && p == thisNum){
downPageHtml = '<span class="showpage"> <a href="'+htmlMap[p]+'">'+ downPageWord +'</a></span>';
eFlag++;
}
}//end if(p>=(thisNum-displayPageNum-1) && p<(thisNum+displayPageNum)){
}//end for(var p =0;p< htmlMap.length;p++){
if(thisNum>1){
if(!isLablePage){
html = '<span class="showpage"><a href="/">'+ firstPageWord +' </a></span>'+upPageHtml+' '+html +' ';
}else{
html = ''+labelHtml + firstPageWord +' </a></span>'+upPageHtml+' '+html +' ';
}
}
html = '<div class="showpageArea"><span style="font-size:11px;padding: 2px 4px 2px 4px;margin: 2px 2px 2px 2px;color: #000000;border: 1px solid #333; background-color: #FFFFFF;" class="showpage">Page '+thisNum+' of '+(postNum-1)+': </span>'+html;
if(thisNum<(postNum-1)){
html += downPageHtml;
html += '<span class="showpage"><a href="'+htmlMap[htmlMap.length-1]+'"> '+endPageWord+'</a></span>';
}
if(postNum==1) postNum++;
html += '</div>';
if(isPage isFirstPage isLablePage){
var pageArea = document.getElementsByName("pageArea");
var blogPager = document.getElementById("blog-pager");
if(postNum <= 2){
html ='';
}
for(var p =0;p< pageArea.length;p++){
pageArea[p].innerHTML = html;
}
if(pageArea&&pageArea.length>0){
html ='';
}
if(blogPager){
blogPager.innerHTML = html;
}
}
}
</script>
<script src="/feeds/posts/summary?alt=json-in-script&callback=showpageCount&max-results=99999" type="text/javascript"></script>
<div style=’text-align:right;font-size:10px;color:000000;margin-top:15px;display:none;’> <a href=’http://www.techieblogger.com/2008/07/page-navigation-hack-for-blogger.html’>Grab this Widget ~ Techie Blogger</a></div>
In the code above you can edit the lines in red to your wish .
1 : var pageCount = 5;
The digit in red represents number of posts to be shown in single page. Change the digit to show as many pages you want.
for example :
In my blog I have put that value as 2 . In each page you can see only 2 posts .
2 : var displayPageNum = 3;
here the digit in red represents number of pages to be listed.
For example :
In my blog I have chosen 3 , then 3 pages will be shown.
That’s it now we have added Page Navigation menu hack to our blog successfully .
That CSS code will suit almost all templates. Please don’t remove the credit link.
I hope all of you will like this Page Navigation blogger hack . If you have any doubts please ask in comment section . Comments are most welcome , please give me your feedback about this blogger Hack.
You can also add this Page navigation hack in the another method : Widget style.



31. Jul, 2008 






its Not Working ……………
mmm..nice nifo…but if i post more than 7 in a day and i click page 2 icon,it will go to page 3 …
assalamo alaykom mohamed
jazak allah khayran
thanx alot for the update and for the nice hack but unfortunately it doesn’t work correclty ,there are alot of bugs.
for example there many posts in my blog that are not shown and in the labels page there are many duplicates.
please if you can fix this we will be so grateful .
huhuhuhuhu. its not working! but i love to have like this. please help me!
Hmmm, cool idea but every time I try it when I set it up to show 3 possible page number choices it shows 4, if I selst 4, it offers 5. Then page one, home page is fine, but when I select to go to page two it skips several posts. Page 2 shows the posts that should be on page 4-5. Any ideas? Alan
Mohamed. Sad, it is a good code except obviously has bugs and skips many posts for most users. I will have to trmove it now, it seems you are failing to answer posts on this venue. Bummer.
hello mohamed i tried putting this scipt in my blog but not working can u help me??
thanks in advance
Step 3
Did not find in html coding. Please Advice Me how to fine it.
hay mohamed…salamo 3aleko
thats amazing hack but in my blog does not work ..i don’t know why..so plz give me some more info about that hack
Hello Riaz, I have a blog which has over 200 pages (http://knight-nirvan.blogspot.com) but the code you provided only provide 63 pages,that is on my blog, it says ” Page 1 of 63 “, I want to increase the amount of number pages… that is ” 63 ” not the number of post to be published on one page.Can you help me??
Your Help will be most appreciated.
Please reply me ….
Is there a way to reverse the order of the pages? What I mean is, I would like my first ever post to be on page 1 as opposed to the newest post being on page 1.
Hi there. You are doing a lot of great stuff here. I am still trying to figure out a lot of widgets for my blog, including a label cloud widget for blogger. Is it possible, & is it simple to install. Thanks a lot for your time.
Hi Mohamed, I tried your hack using the HTML editor and it doesn’t seem to be working. I am quite keen to get a navigation option and would appreciate any help you can provide.
Thanks
Brian
mine is classic template can u send me the code to use in classic template of blogger. please my mail is aaboobacker@ctjv.com
@Debajyoti Das
I will write about that soon frnd
Hi, can u help me with this hack pls..?
I’ve install everything (follow from blogger buster and compare it with yours) but nothing changed.
Thank bfore
I tried your Navigation on my custom template but unfortunately it doesn’t work with both of your methods.
Sorry if my english bad, i hope u understand what im try to say.
And Send E-mail hack
Thanks
there are many useful hack! thank you
@ Oases
Welcome to Techie Blogger. You are welcome frnd..
will post more hacks like this soon..
regards,
Mohamed Rias
this script only works if the blog have a few posts per day.
Probably, the problem is in "T00%3A00%3A00%2B08%3A00" at /search?updated-max='+timestamp+'T00%3A00%3A00%2B08%3A00&max-results='+pageCount
and <script type="text/javascript"> don't works yet. the correct: .<.script type='text/javascript'.>. [remove dots]
Dear Rias,
I'm unable to find the code given at step2 in my blog.
Instead I have this code
{I made some modifications by removing < hope u wil understand the code}{ showaddelement='no'>
b:widget id='HTML7' locked='false' title='Page Navigation' type='HTML'/}
/b:section}
Now please tell wat shud i do to get it done?
Thanx.
hey rias your works are marvellous
http://digitalcurves.blogspot.com/
the script doesnt work
My blog has lost older post, home and newer post that I never touch them. Help me! Page navigation not work with all blog of mine.
Salamu alaykum brother.
baraka alah feek akhi, for the “Page Navigation”
you made .
I really need it in my blog ” http://al3arabiya.blogspot.com “
because i have too many postsand the “older post ” button is too small
how can i add this code to my blog ?
http://1.bp.blogspot.com/_xn2gmPb9TfM/SKH-nxZqqUI/AAAAAAAACFE/ST-hC4HWp2w/s320-R/page-navigation.jpg
plz help
if there is no chance , plz tell me what is the template could be work with that “page navigation”
baraka alah fik akhi wa jazak allah khayr
.
Really helpful post .
thank you !
great widget ……….
but it couldn’t working fine….
i installed this widget i think u r the real hacker of the code i found it on some other blogs those just modified css of this…
i like the above navigation style that’s why i use it….
†the problem is when i navigate to next or 2 page it navigates some far and it displays only some posts only â€
just check the below blog and use navigation to understand …..
http://funevil.blogspot.com/search/label/Animal%20Pics?max-results=5
Thanks in ADV
From http://funevil.blogspot.com/
Is it possible to change the word "Pages"?
Open quote is expected for attribute “{1}” associated with an element type “class”.
i am getting this error
explain it
dear friend this trick is not workink in my website
I just don’t understand.Can u help me?
Your Step by Step Method in Explaining such stuff like this is just Simply the best of the Best!
from 5 Websites that I’ve Visited So Far!
Thank you & bPeace be With u!
Best Regards!
Diaz Ikh’san
hi i just used your hack in my new blog http://littlesmsfun.blogspot.com really love it..
I was thinking to change the background image of each page number instead of background color is it possible ?
If yes please reply to my id
itsmeeirsh@gmail.com
can also see my blog
Thanks in advance
Thanks it works on me.
I have followed what you said above in my blog. But i can’t find anything ….
plz check my blog and solve this problem..
it not working here it give the error that my XML, HTML elements are not properly closed mu blog here
I am also missing older post links on my page
Hi,
I’m tired looking for some codes and tricks about how to make a default page on Blogger. So there’s not always a newest post that will be displayed first.
Can you help me please?
Still waiting for response on my comment @ Admin
NIce article. Really nice! But i think that you could give some more info on a couple of points. However, keep on developing your.
[...] I wrote How to add Page Navigation Menu hack by editing your blogger template. Now today I would like to use a different method to add this Page [...]
Wht these error means plz guide me.
(Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: Open quote is expected for attribute “{1}” associated with an element type “style”.)
I Tried both the way by widget and by editing template.
but none working..
i use revolution church template..
tutorialnya mantap banget agan.. ^_^
[...] Page Navigation Hack for Blogger [...]
its not working
[...] on many wordpress blogs(wp-pagenavi by Lester Chan). Muhammad Rias of Techie Blogger had already developed a [...]
Hi There !
I have updated the code. Please get the new code here
Page Navigation hack – Bugs Fixed
regards,
Mohamed Rias
[...] Page Navigation Hack for Blogger – Blogger template customization Method [...]
[...] type="text/javascript"></script> Grab this Widget ~ Blogger Accessories [/cc] In the code above you can edit the lines in red to your wish . 1 : var pageCount = 5; The [...]
Thanks for the useful post….
i added it in my page
http://freeindiansms.blogspot.com its looking cool….
the thing is i would like to add images in page number button is it possible?? pls help…