
Page Navigation, or "page number" will appear in your home, label and archive page, which allows you with easy access to readers in the archives. However, the page number will not appear on the page post. I have seen many blogs that use the pagination like this, and in between them does not shown in the bottom of this page each post. To learn more about using the pagination script for Blogger.
As you may have noticed, I'm using a slightly modified version of this script here on Recycle Blog. When customizing the style of blogger buster original version, I noticed a few elements which I preferred to change for my own preferences, and also modified the CSS for how the numbered links are displayed.
If you would prefer to use this slightly different version instead, here is what you should do.
Add the CSS code to your style section
Firstly, copy all of the code below and paste this just before the closing </b:skin> tag in your template:
Add the JavaScript code beneath your posts
The second part of the installation is to add the JavaScript code beneath your posts which will locate and replace the existing "Newer/Older Posts" link. To add this script, go to Layout>Edit HTML in your Blogger dashboard, and do not tick the "expand widget templates" box (it's much easier to add the code while the widgets are contracted). Then find this section of code (or similar) in your template:
Immediately after the closing </b:section> tag, add the following section of code:
Copy code above ago pharse Here then paste below </b:section>
I hope this post has helped you learn about how numbered page navigation can be achieved in Blogger powered blogs using Mohamed's original methods or my slightly modified script.
Please let me know what you think of these methods, or if you experience any problems, by leaving your comments below.
As you may have noticed, I'm using a slightly modified version of this script here on Recycle Blog. When customizing the style of blogger buster original version, I noticed a few elements which I preferred to change for my own preferences, and also modified the CSS for how the numbered links are displayed.
If you would prefer to use this slightly different version instead, here is what you should do.
Add the CSS code to your style section
Firstly, copy all of the code below and paste this just before the closing </b:skin> tag in your template:
/******************************************
Page Navigation script, version 2.0 (for blogspot)
(C)2009 by
_ _ _____ _ _____ _____ _____
| | / / | _ \ | | | ____| | _ \ /___ \
| |/ / | |_| | | | | |__ | |_| | ___| |
| |\ \ | _ / | | | __| | ___/ / ___/
| | \ \ | | \ \ | | | |___ | | | |___
|_| \_\ |_| \_\ |_| |_____| |_| |_____|
visit http://www.kriep2.co.cc to get more Recycle Tips
********************************************/
.showpageArea a {
text-decoration:underline;
}
.showpageNum a {
text-decoration:none;
border: 2px solid #ccc;
-moz-border-radius: 4px;
margin:0 3px;
padding:3px;
}
.showpageNum a:hover {
border: 2px inset #ccc;
-moz-border-radius: 4px;
background-color:rgb(240,247,249);
}
.showpagePoint {
color:#333;
text-decoration:blink;
border: 2px solid #ccc;
-moz-border-radius: 4px;
background:rgb(240,247,249);
margin:0 3px;
padding:3px;
}
.showpageOf {
text-decoration:none;
padding:3px;
margin: 0 3px 0 0;
}
.showpage a {
text-decoration:none;
border: 2px solid #ccc;
-moz-border-radius: 4px;
padding:3px;
}
.showpage a:hover {
border: 2px inset #ccc;
-moz-border-radius: 4px;
background-color:rgb(240,247,249);
}
.showpageNum a:link,.showpage a:link {
text-decoration:none;
color:#333;
}
Page Navigation script, version 2.0 (for blogspot)
(C)2009 by
_ _ _____ _ _____ _____ _____
| | / / | _ \ | | | ____| | _ \ /___ \
| |/ / | |_| | | | | |__ | |_| | ___| |
| |\ \ | _ / | | | __| | ___/ / ___/
| | \ \ | | \ \ | | | |___ | | | |___
|_| \_\ |_| \_\ |_| |_____| |_| |_____|
visit http://www.kriep2.co.cc to get more Recycle Tips
********************************************/
.showpageArea a {
text-decoration:underline;
}
.showpageNum a {
text-decoration:none;
border: 2px solid #ccc;
-moz-border-radius: 4px;
margin:0 3px;
padding:3px;
}
.showpageNum a:hover {
border: 2px inset #ccc;
-moz-border-radius: 4px;
background-color:rgb(240,247,249);
}
.showpagePoint {
color:#333;
text-decoration:blink;
border: 2px solid #ccc;
-moz-border-radius: 4px;
background:rgb(240,247,249);
margin:0 3px;
padding:3px;
}
.showpageOf {
text-decoration:none;
padding:3px;
margin: 0 3px 0 0;
}
.showpage a {
text-decoration:none;
border: 2px solid #ccc;
-moz-border-radius: 4px;
padding:3px;
}
.showpage a:hover {
border: 2px inset #ccc;
-moz-border-radius: 4px;
background-color:rgb(240,247,249);
}
.showpageNum a:link,.showpage a:link {
text-decoration:none;
color:#333;
}
Add the JavaScript code beneath your posts
The second part of the installation is to add the JavaScript code beneath your posts which will locate and replace the existing "Newer/Older Posts" link. To add this script, go to Layout>Edit HTML in your Blogger dashboard, and do not tick the "expand widget templates" box (it's much easier to add the code while the widgets are contracted). Then find this section of code (or similar) in your template:
<b:section class='main' id='main' showaddelement='yes'> <b:widget id='Blog1' locked='false' title='Blog Posts' type='Blog'/> </b:section>
Immediately after the closing </b:section> tag, add the following section of code:
<script type="text/javascript">
function showpageCount(json) {
var thisUrl = location.href;
var htmlMap = new Array();
var isFirstPage = thisUrl.substring(thisUrl.length-5,thisUrl.length)==".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 = 5;
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 += '<span class="showpagePoint">'+thisNum+'</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 = ''+upPageHtml+' '+html +' ';
}else{
html = ''+upPageHtml+' '+html +' ';
}
}
html = '<div class="showpageArea"><span style="COLOR: #000;" class="showpageOf"> Pages ('+(postNum-1)+')</span>'+html;
if(thisNum<(postNum-1)){
html += downPageHtml;
}
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>
function showpageCount(json) {
var thisUrl = location.href;
var htmlMap = new Array();
var isFirstPage = thisUrl.substring(thisUrl.length-5,thisUrl.length)==".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 = 5;
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 += '<span class="showpagePoint">'+thisNum+'</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 = ''+upPageHtml+' '+html +' ';
}else{
html = ''+upPageHtml+' '+html +' ';
}
}
html = '<div class="showpageArea"><span style="COLOR: #000;" class="showpageOf"> Pages ('+(postNum-1)+')</span>'+html;
if(thisNum<(postNum-1)){
html += downPageHtml;
}
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>
Copy code above ago pharse Here then paste below </b:section>
I hope this post has helped you learn about how numbered page navigation can be achieved in Blogger powered blogs using Mohamed's original methods or my slightly modified script.
Please let me know what you think of these methods, or if you experience any problems, by leaving your comments below.
Related Article for this post :






7 comments:
nice, i'am not a have problem
Hi, I am currently using old version of blogger thus cannot find "" in my html editor...
do you have any suggestion for me except upgrading it? Just worried my current settings will gone after upgrade as I started my blog at 2003....
Prior hanks for you help.
Hi, I am currently using old version of blogger thus cannot find "" in my html editor...
do you have any suggestion for me except upgrading it? Just worried my current settings will gone after upgrade as I started my blog at 2003....
Prior hanks for you help.
max
Hi, I am currently using old version of blogger thus cannot find "" in my html editor...
do you have any suggestion for me except upgrading it? Just worried my current settings will gone after upgrade as I started my blog at 2003....
Prior hanks for you help.
max
i mean... i cannot find word "skin" in my old version blogger html..
max
Şablonul dvs. nu poate fi analizat, deoarece nu este bine format. Vă rugăm să vă asiguraţi că toate elementele XML sunt închise cum trebuie.
Mesaj de eroare XML: The reference to entity "max-results" must end with the ';' delimiter.
Error 500 nu inteleg ce nu e inchis bine
Şablonul dvs. nu poate fi analizat, deoarece nu este bine format. Vă rugăm să vă asiguraţi că toate elementele XML sunt închise cum trebuie.
Mesaj de eroare XML: The reference to entity "max-results" must end with the ';' delimiter.
Error 500 sorry but what was going bad
Post a Comment