How to Add Page Number Navigation in Blogger - My Widget House

LATEST

Tuesday, 27 February 2018

How to Add Page Number Navigation in Blogger

How to Add Page Number Navigation in Blogger

As like me most of the other bloggers must also have disliked the older post, home and newer post in the main page of the blogger. With my full research on them finally I am successful to change the page navigation in my blogs. And I am sure that you will also like to have them in your own blog.

This function is very useful and helpful for our blog to increase visitors. As we know that blogger have default setting in it which shows Newer PostsHome and Older Posts in front page. And when the visitor clicks on it, it just change only single group of posts. But if we install the page navigation in the blogger, then visitors will be easy to navigate to most older posts etc.


So, I am sure that as I am happy to install the page navigation in my blogs. Then you will also be happy to have the page navigation menu in your blog. Which are different in colours and also looks beautiful.

So, lets start to add the page navigation menu in the blogger.

Add the Page Navigation Menu in Blogger

Adding the page navigation menu in blogger is very simple. You just need to follow these two steps:

  1. Add HTML code in blogger.
  2. Add the script in blogger
Both steps are very easy but necessary to install the page navigation in your blog. Lets start first step:

1. Add HTML Code in Blogger

To add the HTML code in blogger theme, follow these simple steps:

Step 1

Click on the Theme in left side bar of your blogger Dashboard. As marked in the picture below


Step 2

Click on the grey Edit HTML button as marked in the picture below.

Step 3

Now press Ctrl+F from your keyboard and find the following code.
]]></b:skin>

Now just Above this ]]></b:skin> code, Paste one of the following style code which you like.

Grey Colour Page Navigation Menu


 #blog-pager{clear:both;margin:30px auto;text-align:center; padding: 7px;}
.blog-pager {background: none;}.displaypageNum a,.showpage a,.pagecurrent{padding: 3px 7px;margin-right:5px;background:#E9E9E9;color: #888;border:1px solid #E9E9E9;}.displaypageNum a:hover,.showpage a:hover,.pagecurrent{background:#CECECE;text-decoration:none;color: #000;} .showpageOf{display:none!important}#blog-pager .showpage, #blog-pager .pagecurrent{font-weight:bold;color: #888;} #blog-pager .pages{border:none;}

Black And Orange Page Navigation Menu



 #blog-pager{clear:both;margin:30px auto;text-align:center; padding: 7px;}
.blog-pager {background: none;}
.displaypageNum a,.showpage a,.pagecurrent{padding: 5px 10px;margin-right:5px; color: #F4F4F4; background-color:#404042;-webkit-box-shadow: 0px 5px 3px -1px rgba(50, 50, 50, 0.53);-moz-box-shadow:0px 5px 3px -1px rgba(50, 50, 50, 0.53);box-shadow: 0px 5px 3px -1px rgba(50, 50, 50, 0.53);}
.displaypageNum a:hover,.showpage a:hover, .pagecurrent{background:#EC8D04;text-decoration:none;color: #fff;}
#blog-pager .showpage, #blog-pager, .pagecurrent{font-weight:bold;color: #000;}
 .showpageOf{display:none!important}
#blog-pager .pages{border:none;-webkit-box-shadow: 0px 5px 3px -1px rgba(50, 50, 50, 0.53);-moz-box-shadow:0px 5px 3px -1px rgba(50, 50, 50, 0.53);box-shadow: 0px 5px 3px -1px rgba(50, 50, 50, 0.53);}


Black And Blue Page Navigation Menu



 #blog-pager{clear:both;margin:30px auto; padding: 7px; text-align:center;font-size: 11px;background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #000000),color-stop(1, #292929));background-image: -o-linear-gradient(top, #000000 0%, #292929 100%);background-image: -moz-linear-gradient(top, #000000 0%, #292929 100%);background-image: -webkit-linear-gradient(top, #000000 0%, #292929 100%);background-image: -ms-linear-gradient(top, #000000 0%, #292929 100%);background-image: linear-gradient(to top, #000000 0%, #292929 100%); padding: 6px;-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;}
.blog-pager {background: none;}.displaypageNum a,.showpage a,.pagecurrent{padding: 3px 10px;margin-right:5px; color: #fff;}.displaypageNum a:hover,.showpage a:hover,.pagecurrent{background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #59A2CF),color-stop(1, #D9EAFF));background-image: -o-linear-gradient(top, #59A2CF 0%, #D9EAFF 100%);background-image: -moz-linear-gradient(top, #59A2CF 0%, #D9EAFF 100%);background-image: -webkit-linear-gradient(top, #59A2CF 0%, #D9EAFF 100%);background-image: -ms-linear-gradient(top, #59A2CF 0%, #D9EAFF 100%);background-image: linear-gradient(to top, #59A2CF 0%, #D9EAFF 100%);text-decoration: none;color: #000;-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;}.showpageOf{display:none!important}.blog-pager-older-link, .home-link, .blog-pager-newer-link {background: transparent;}a.blog-pager-older-link, a.home-link, a.blog-pager-newer-link {color: #fff;}#blog-pager .pages{border:none;background: none;}

Blue And Grey Navigation Menu



#blog-pager{clear:both;margin:30px auto;text-align:center; padding: 7px;}
.blog-pager {background: none;}
.displaypageNum a,.showpage a,.pagecurrent{font-size: 14px;padding: 5px 12px;margin-right:5px; color: #666; background-color:#eee;}
.displaypageNum a:hover,.showpage a:hover, .pagecurrent{background:#359BED;text-decoration:none;color: #fff;}
#blog-pager .pagecurrent{font-weight:bold;color: #fff;background:#359BED;}
 .showpageOf{display:none!important}
#blog-pager .pages{border:none;}


Orange And Green Navigation Menu with Pink Hover Effect



#blog-pager{clear:both;margin:30px auto;text-align:center; padding: 7px; }
.blog-pager {background: none;}
.displaypageNum a,.showpage a,.pagecurrent{font-size: 13px;padding: 5px 12px;margin-right:5px; color: #3E5801; background-color:#E0EDC1;}
.displaypageNum a:hover,.showpage a:hover, .pagecurrent{background:#FEF6DF;text-decoration:none;color: #E16800;}
#blog-pager .pagecurrent{font-weight:bold;color: #D25E71;background:#FFDEDF;}
 .showpageOf{display:none!important}
#blog-pager .pages{border:none;}


Red And Yellow Navigation Menu



#blog-pager{clear:both;margin:30px auto;text-align:center; padding: 7px; }
.blog-pager {background: none;}
.displaypageNum a,.showpage a,.pagecurrent{font-size: 13px;padding: 5px 12px;margin-right:5px; color: #AD0B00; background-color:#FAB001;}
.displaypageNum a:hover,.showpage a:hover, .pagecurrent{background:#DB4920;text-decoration:none;color: #fff;}
#blog-pager .pagecurrent{font-weight:bold;color: #fff;background:#DB4920;}
 .showpageOf{display:none!important}
#blog-pager .pages{border:none;}

Red And Grey Navigation Menu



#blog-pager{clear:both;margin:30px auto;text-align:center; padding: 7px; }
.blog-pager {background: none;}
.displaypageNum a,.showpage a,.pagecurrent{font-size: 12px;padding: 5px 12px;margin-right:5px; color: #222; background-color:#eee; border: 1px solid #EEEEEE;}
.displaypageNum a:hover,.showpage a:hover, .pagecurrent{background:#E5E5E5;text-decoration:none;color: #222;}
#blog-pager .pagecurrent{font-weight:bold;color: #fff;background:#DB4920;}
 .showpageOf{display:none!important}
#blog-pager .pages{border:none;}


After selecting your favorite design, Copy its code and add it in CSS as I showed you above. If you want to hide First Page and Last page in the Navigation Menu, simply copy the following code and paste it below the design's code.
.firstpage, .lastpage {display: none;}

Now you are all OK with first step. Lets proceed to the next step.

2. Add the script in Blogger

Now it is time to add the script of the Page Navigation Menu in Blogger. This is the best navigation menu and it support more then 500 blog posts. So, lets start to install the scripts of it.

Step 4

Press Ctrl+F from your keyboard and find the following tag in the box.

</body>

You found it? Good! Now add the following code from the box just above it:
<b:if cond='data:blog.pageType != &quot;item&quot;'>
<b:if cond='data:blog.pageType != &quot;static_page&quot;'><script type='text/javascript'>  /*<![CDATA[*/    var perPage=3;    var numPages=3;    var firstText ='First';    var lastText ='Last';    var prevText ='« Previous';    var nextText ='Next »';    var urlactivepage=location.href;    var home_page="/";
if(typeof firstText=="undefined")firstText="First";if(typeof lastText=="undefined")lastText="Last";var noPage;var currentPage;var currentPageNo;var postLabel;pagecurrentg();function looppagecurrentg(pageInfo){var html='';pageNumber=parseInt(numPages / 2);if(pageNumber==numPages-pageNumber){numPages=pageNumber*2+1}pageStart=currentPageNo-pageNumber;if(pageStart<1)pageStart=1;lastPageNo=parseInt(pageInfo / perPage)+1;if(lastPageNo-1==pageInfo / perPage)lastPageNo=lastPageNo-1;pageEnd=pageStart+numPages-1;if(pageEnd>lastPageNo)pageEnd=lastPageNo;html+="<span class='showpageOf'>Page "+currentPageNo+' of '+lastPageNo+"</span>";var prevNumber=parseInt(currentPageNo)-1;if(currentPageNo>1){if(currentPage=="page"){html+='<span class="showpage firstpage"><a href="'+home_page+'">'+firstText+'</a></span>'}else{html+='<span class="displaypageNum firstpage"><a href="/search/label/'+postLabel+'?&max-results='+perPage+'">'+firstText+'</a></span>'}}if(currentPageNo>2){if(currentPageNo==3){if(currentPage=="page"){html+='<span class="showpage"><a href="'+home_page+'">'+prevText+'</a></span>'}else{html+='<span class="displaypageNum"><a href="/search/label/'+postLabel+'?&max-results='+perPage+'">'+prevText+'</a></span>'}}else{if(currentPage=="page"){html+='<span class="displaypageNum"><a href="#" onclick="redirectpage('+prevNumber+');return false">'+prevText+'</a></span>'}else{html+='<span class="displaypageNum"><a href="#" onclick="redirectlabel('+prevNumber+');return false">'+prevText+'</a></span>'}}}if(pageStart>1){if(currentPage=="page"){html+='<span class="displaypageNum"><a href="'+home_page+'">1</a></span>'}else{html+='<span class="displaypageNum"><a href="/search/label/'+postLabel+'?&max-results='+perPage+'">1</a></span>'}}if(pageStart>2){html+=' ... '}for(var jj=pageStart;jj<=pageEnd;jj++){if(currentPageNo==jj){html+='<span class="pagecurrent">'+jj+'</span>'}else if(jj==1){if(currentPage=="page"){html+='<span class="displaypageNum"><a href="'+home_page+'">1</a></span>'}else{html+='<span class="displaypageNum"><a href="/search/label/'+postLabel+'?&max-results='+perPage+'">1</a></span>'}}else{if(currentPage=="page"){html+='<span class="displaypageNum"><a href="#" onclick="redirectpage('+jj+');return false">'+jj+'</a></span>'}else{html+='<span class="displaypageNum"><a href="#" onclick="redirectlabel('+jj+');return false">'+jj+'</a></span>'}}}if(pageEnd<lastPageNo-1){html+='...'}if(pageEnd<lastPageNo){if(currentPage=="page"){html+='<span class="displaypageNum"><a href="#" onclick="redirectpage('+lastPageNo+');return false">'+lastPageNo+'</a></span>'}else{html+='<span class="displaypageNum"><a href="#" onclick="redirectlabel('+lastPageNo+');return false">'+lastPageNo+'</a></span>'}}var nextnumber=parseInt(currentPageNo)+1;if(currentPageNo<(lastPageNo-1)){if(currentPage=="page"){html+='<span class="displaypageNum"><a href="#" onclick="redirectpage('+nextnumber+');return false">'+nextText+'</a></span>'}else{html+='<span class="displaypageNum"><a href="#" onclick="redirectlabel('+nextnumber+');return false">'+nextText+'</a></span>'}}if(currentPageNo<lastPageNo){if(currentPage=="page"){html+='<span class="displaypageNum lastpage"><a href="#" onclick="redirectpage('+lastPageNo+');return false">'+lastText+'</a></span>'}else{html+='<span class="displaypageNum lastpage"><a href="#" onclick="redirectlabel('+lastPageNo+');return false">'+lastText+'</a></span>'}}var pageArea=document.getElementsByName("pageArea");var blogPager=document.getElementById("blog-pager");for(var p=0;p<pageArea.length;p++){pageArea[p].innerHTML=html}if(pageArea&&pageArea.length>0){html=''}if(blogPager){blogPager.innerHTML=html}}function totalcountdata(root){var feed=root.feed;var totaldata=parseInt(feed.openSearch$totalResults.$t,10);looppagecurrentg(totaldata)}function pagecurrentg(){var thisUrl=urlactivepage;if(thisUrl.indexOf("/search/label/")!=-1){if(thisUrl.indexOf("?updated-max")!=-1){postLabel=thisUrl.substring(thisUrl.indexOf("/search/label/")+14,thisUrl.indexOf("?updated-max"))}else{postLabel=thisUrl.substring(thisUrl.indexOf("/search/label/")+14,thisUrl.indexOf("?&max"))}}if(thisUrl.indexOf("?q=")==-1&&thisUrl.indexOf(".html")==-1){if(thisUrl.indexOf("/search/label/")==-1){currentPage="page";if(urlactivepage.indexOf("#PageNo=")!=-1){currentPageNo=urlactivepage.substring(urlactivepage.indexOf("#PageNo=")+8,urlactivepage.length)}else{currentPageNo=1}document.write("<script src=\""+home_page+"feeds/posts/summary?max-results=1&alt=json-in-script&callback=totalcountdata\"><\/script>")}else{currentPage="label";if(thisUrl.indexOf("&max-results=")==-1){perPage=20}if(urlactivepage.indexOf("#PageNo=")!=-1){currentPageNo=urlactivepage.substring(urlactivepage.indexOf("#PageNo=")+8,urlactivepage.length)}else{currentPageNo=1}document.write('<script src="'+home_page+'feeds/posts/summary/-/'+postLabel+'?alt=json-in-script&callback=totalcountdata&max-results=1" ><\/script>')}}}function redirectpage(numberpage){jsonstart=(numberpage-1)*perPage;noPage=numberpage;var nameBody=document.getElementsByTagName('head')[0];var newInclude=document.createElement('script');newInclude.type='text/javascript';newInclude.setAttribute("src",home_page+"feeds/posts/summary?start-index="+jsonstart+"&max-results=1&alt=json-in-script&callback=finddatepost");nameBody.appendChild(newInclude)}function redirectlabel(numberpage){jsonstart=(numberpage-1)*perPage;noPage=numberpage;var nameBody=document.getElementsByTagName('head')[0];var newInclude=document.createElement('script');newInclude.type='text/javascript';newInclude.setAttribute("src",home_page+"feeds/posts/summary/-/"+postLabel+"?start-index="+jsonstart+"&max-results=1&alt=json-in-script&callback=finddatepost");nameBody.appendChild(newInclude)}function finddatepost(root){post=root.feed.entry[0];var timestamp1=post.published.$t.substring(0,19)+post.published.$t.substring(23,29);var timestamp=encodeURIComponent(timestamp1);if(currentPage=="page"){var pAddress="/search?updated-max="+timestamp+"&max-results="+perPage+"#PageNo="+noPage}else{var pAddress="/search/label/"+postLabel+"?updated-max="+timestamp+"&max-results="+perPage+"#PageNo="+noPage}location.href=pAddress}
  /*]]>*/</script></b:if></b:if>

Now you are OK with both HTML codes and Scripts. And it is successfully added in your blog. But If you want to configure the navigation menu, then you can edit it as:

Configure Page Navigation Menu

To change the default settings to your personalized setting, simply change the following things in the code you added in your blog.

perPage: 3,
numPages: 3,
var firstText ='First';
var lastText ='Last';
var prevText ='« Previous';
var nextText ='Next »';
}


Just change the red marked areas in the above code which you have already entered in your blog. In which the red marked things belongs to the following areas:

- perPage is the number of post in the single page of the Navigation Menu.
- numPages is the number of pages shown in the Navigation Menu.
- Fist is the Button which navigate to very first post of the blog.
- Last is the Button which navigate to Last post of the blog.
- Previous is the Button to navigate to the previous page of the Navigation Menu.
- Next is the Button to navigate to the next page of the Navigation Menu.

Labels Setting

One last and important thing in the configuration of the Navigation Menu is Labels settings. If any user click on the Label of Post to see related posts, then blogger randomly show 20 posts per page. If you want to decrease the number of posts per page in Label search. Then follow these steps:

Step 5

Press Ctrl+F with keyboard and find the following code in the below box

expr:href='data:label.url'

Now replace this code with the following code in the box

expr:href='data:label.url + "?&amp;max-results=7"'

As you know how to configure this code. So, you can change the 7 with your own number of posts.

Step 6

Now click on the Save Template button and save the entire settings you just applied into your theme. Enjoy the new great looking navigation menu of your website.

2 comments:

  1. Not work for me nothing show

    ReplyDelete
  2. Are you looking to design your blog? Or to add any widget in your blog?
    we provide you the solution of your this problem just only in a single platform.
    You can visit our website for all details: mywidgethouse.blogspot.com
    Or directly go on the particular topic below:
    1. How to add html code box in blogger post?
    https://mywidgethouse.blogspot.com/2018/02/how-to-add-html-code-box-in-blogger-post.html

    2. How to Change Text Selection Colour in Blogger?
    https://mywidgethouse.blogspot.com/2018/02/how-to-change-text-selection-colour-in.html

    3. How to Add Page Number Navigation in Blogger?
    https://mywidgethouse.blogspot.com/2018/02/how-to-add-page-number-navigation-in.html

    4. How to change comment box style with CSS?
    https://mywidgethouse.blogspot.com/2018/02/how-to-change-comment-box-style-with.html

    5. How to add weather widget in blogger?
    https://mywidgethouse.blogspot.com/2018/02/how-to-add-weather-widget-in-blogger-my.html

    6. How to add a Facebook Like Box in blogger?
    https://mywidgethouse.blogspot.com/2018/02/how-to-add-facebook-like-box-in-blogger.html

    7. How to Customize Read More Button in Blogger?
    https://mywidgethouse.blogspot.com/2018/02/how-to-customize-read-more-button-in.html

    8. How to Change Powered by Blogger Footer Attribution from a Blog?
    https://mywidgethouse.blogspot.com/2018/03/how-to-change-powered-by-blogger-footer.html

    9. How to Change Scroll Bar Style in Blogger?
    https://mywidgethouse.blogspot.com/2018/03/how-to-change-scroll-bar-style-in.html

    10. How to Add Favicon in Blogger?
    https://mywidgethouse.blogspot.com/2018/03/How-to-Add-Favicon-in-Blogger-My-Widget-House.html

    11. Add social share buttons in blogger
    https://mywidgethouse.blogspot.com/2018/03/add-social-share-buttons-in-blogger-my-widget-house.html

    12. How to remove subscribe to post atom and subscribe to post comment from blog?
    https://mywidgethouse.blogspot.com/2018/03/How-to-remove-subscribe-to-post-atom-and-subscribe-to-post-comment-from-blog-My-Widget-House.html

    13. How to Enable or Disable Comments in Blogger Posts or Page?
    https://mywidgethouse.blogspot.com/2018/03/How-to-Enable-or-Disable-Comments-in-Blogger-Posts-or-Page-My-Widget-House.html

    14. Eligibility Criteria of Google Adsense for Blogger?
    https://mywidgethouse.blogspot.com/2018/03/eligibility-criteria-of-google-adsense.html

    15. How to center Blogger Pages Menu?
    https://mywidgethouse.blogspot.com/2018/03/How-to-center-Blogger-Pages-Menu-My-Widget-House.html

    16. How to add related post widget in blogger post?
    https://mywidgethouse.blogspot.com/2018/03/How-to-add-related-post-widget-in-blogger-post-My-Widget-House.html

    17. How to add jump break or read more link in blogger post?
    https://mywidgethouse.blogspot.com/2018/03/How-to-add-jump-break-or-read-more-link-in-blogger-post-My-Widget-House.html

    ReplyDelete