Pagination code for blogger

How do I Add Page Number to my Post page in Blogger?


If you want the pages to be visible at the end of your website then this post will be very beneficial for you because in this you will learn how you can put a pagination system on your website's page; this method works very well in Blogger.





You don't have to do anything, you just have to follow the code as given.


First of all you have to go to your blogger theme's settings, after going to the blogger theme's settings you have to edit the HTML and do starl + f in it so that it can be searched and after that search this thing- ]]></b:skin> after searching press enter. After pressing enter, paste this code: <style>.showpageOf{display:inline-block;font-size:90%;padding:7px 12px;vertical-align:top;line-height:20px;}.showpagePoint{background:#333;color:#fff;display:inline-block;vertical-align:top;padding:7px 12px;margin:0;font-size:14px ;text-align:center;border-left:1px solid #f0f0f0;box-shadow:inset 0 1px 1px rgba(0,0,0,0.1);transition:initial}.showpage a,.showpageNum a{display:inline-block;vertical-align:top;line-height:20px;padding:7px 12px;margin:0;font-size:14px;text-align:center;border-left:1px solid #f0f0f0;transition:color .3s}.showpage a:hover,.showpageNum a:hover{background-color:#fefefe;color:#454545;box-shadow:inset 0 1px 1px rgba(0,0,0,0.1);transition:color .3s}</style>


After this, what you have to do is that you have to do Control + F again, and then paste the given code, after that click on SAVE, by doing this your work will be done and if you refresh your website, you will definitely see the page buttons in it.


After pagination is done, your website will look very amazing, viewers can easily go to that page by clicking on any number and can see their desired thing and that too easily. So this is how you learned how to apply pagination system on your blog post, especially on blogger? Believe me this method is not fake, it is absolutely hundred percent working method, you just try it once








Ctrl + F
-------------------------------------------------------

]]></b:skin>

<style>
.showpageOf{display:inline-block;font-size:90%;padding:7px 12px;vertical-align:top;line-height:20px;}
.showpagePoint{background:#333;color:#fff;display:inline-block;vertical-align:top;line-height:20px;padding:7px 12px;margin:0;font-size:14px;text-align:center;border-left:1px solid #f0f0f0;box-shadow:inset 0 1px 1px rgba(0,0,0,0.1);transition:initial}
.showpage a,.showpageNum a{display:inline-block;vertical-align:top;line-height:20px;padding:7px 12px;margin:0;font-size:14px;text-align:center;border-left:1px solid #f0f0f0;transition:color .3s}
.showpage a:hover,.showpageNum a:hover{background-color:#fefefe;color:#454545;box-shadow:inset 0 1px 1px rgba(0,0,0,0.1);transition:color .3s}
</style>

After this find in your HTML editor closing tag </body>  before it paste the following JS:

</body>

<b:if cond='data:blog.pageType != &quot;item&quot;'>
<script type='text/javascript'>
/*<![CDATA[*/
var postperpage=15;var numshowpage=15;var upPageWord ='Prev';var downPageWord ='Next';var urlactivepage=location.href;var home_page="/";
/*]]>*/
</script>
<script>
var _0xc811=["","\x3C\x73\x70\x61\x6E\x20\x63\x6C\x61\x73\x73\x3D\x27\x73\x68\x6F\x77\x70\x61\x67\x65\x4F\x66\x27\x3E\x50\x61\x67\x65\x20","\x20\x6F\x66\x20","\x3C\x2F\x73\x70\x61\x6E\x3E","\x70\x61\x67\x65","\x3C\x73\x70\x61\x6E\x20\x63\x6C\x61\x73\x73\x3D\x22\x73\x68\x6F\x77\x70\x61\x67\x65\x22\x3E\x3C\x61\x20\x68\x72\x65\x66\x3D\x22","\x22\x3E","\x3C\x2F\x61\x3E\x3C\x2F\x73\x70\x61\x6E\x3E","\x3C\x73\x70\x61\x6E\x20\x63\x6C\x61\x73\x73\x3D\x22\x73\x68\x6F\x77\x70\x61\x67\x65\x4E\x75\x6D\x22\x3E\x3C\x61\x20\x68\x72\x65\x66\x3D\x22\x2F\x73\x65\x61\x72\x63\x68\x2F\x6C\x61\x62\x65\x6C\x2F","\x3F\x26\x6D\x61\x78\x2D\x72\x65\x73\x75\x6C\x74\x73\x3D","\x3C\x73\x70\x61\x6E\x20\x63\x6C\x61\x73\x73\x3D\x22\x73\x68\x6F\x77\x70\x61\x67\x65\x4E\x75\x6D\x22\x3E\x3C\x61\x20\x68\x72\x65\x66\x3D\x22\x23\x22\x20\x6F\x6E\x63\x6C\x69\x63\x6B\x3D\x22\x72\x65\x64\x69\x72\x65\x63\x74\x70\x61\x67\x65\x28","\x29\x3B\x72\x65\x74\x75\x72\x6E\x20\x66\x61\x6C\x73\x65\x22\x3E","\x3C\x73\x70\x61\x6E\x20\x63\x6C\x61\x73\x73\x3D\x22\x73\x68\x6F\x77\x70\x61\x67\x65\x4E\x75\x6D\x22\x3E\x3C\x61\x20\x68\x72\x65\x66\x3D\x22\x23\x22\x20\x6F\x6E\x63\x6C\x69\x63\x6B\x3D\x22\x72\x65\x64\x69\x72\x65\x63\x74\x6C\x61\x62\x65\x6C\x28","\x3C\x73\x70\x61\x6E\x20\x63\x6C\x61\x73\x73\x3D\x22\x73\x68\x6F\x77\x70\x61\x67\x65\x4E\x75\x6D\x22\x3E\x3C\x61\x20\x68\x72\x65\x66\x3D\x22","\x22\x3E\x31\x3C\x2F\x61\x3E\x3C\x2F\x73\x70\x61\x6E\x3E","\x3C\x73\x70\x61\x6E\x20\x63\x6C\x61\x73\x73\x3D\x22\x73\x68\x6F\x77\x70\x61\x67\x65\x50\x6F\x69\x6E\x74\x22\x3E","\x70\x61\x67\x65\x41\x72\x65\x61","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x4E\x61\x6D\x65","\x62\x6C\x6F\x67\x2D\x70\x61\x67\x65\x72","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x6C\x65\x6E\x67\x74\x68","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x66\x65\x65\x64","\x6F\x70\x65\x6E\x53\x65\x61\x72\x63\x68\x24\x74\x6F\x74\x61\x6C\x52\x65\x73\x75\x6C\x74\x73","\x2F\x73\x65\x61\x72\x63\x68\x2F\x6C\x61\x62\x65\x6C\x2F","\x69\x6E\x64\x65\x78\x4F\x66","\x3F\x75\x70\x64\x61\x74\x65\x64\x2D\x6D\x61\x78","\x73\x75\x62\x73\x74\x72\x69\x6E\x67","\x3F\x26\x6D\x61\x78","\x3F\x71\x3D","\x2E\x68\x74\x6D\x6C","\x23\x50\x61\x67\x65\x4E\x6F\x3D","\x3C\x73\x63\x72\x69\x70\x74\x20\x73\x72\x63\x3D\x22","\x66\x65\x65\x64\x73\x2F\x70\x6F\x73\x74\x73\x2F\x73\x75\x6D\x6D\x61\x72\x79\x3F\x6D\x61\x78\x2D\x72\x65\x73\x75\x6C\x74\x73\x3D\x31\x26\x61\x6C\x74\x3D\x6A\x73\x6F\x6E\x2D\x69\x6E\x2D\x73\x63\x72\x69\x70\x74\x26\x63\x61\x6C\x6C\x62\x61\x63\x6B\x3D\x68\x69\x74\x75\x6E\x67\x74\x6F\x74\x61\x6C\x64\x61\x74\x61\x22\x3E\x3C\x2F\x73\x63\x72\x69\x70\x74\x3E","\x77\x72\x69\x74\x65","\x6C\x61\x62\x65\x6C","\x26\x6D\x61\x78\x2D\x72\x65\x73\x75\x6C\x74\x73\x3D","\x66\x65\x65\x64\x73\x2F\x70\x6F\x73\x74\x73\x2F\x73\x75\x6D\x6D\x61\x72\x79\x2F\x2D\x2F","\x3F\x61\x6C\x74\x3D\x6A\x73\x6F\x6E\x2D\x69\x6E\x2D\x73\x63\x72\x69\x70\x74\x26\x63\x61\x6C\x6C\x62\x61\x63\x6B\x3D\x68\x69\x74\x75\x6E\x67\x74\x6F\x74\x61\x6C\x64\x61\x74\x61\x26\x6D\x61\x78\x2D\x72\x65\x73\x75\x6C\x74\x73\x3D\x31\x22\x20\x3E\x3C\x2F\x73\x63\x72\x69\x70\x74\x3E","\x68\x65\x61\x64","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65","\x73\x63\x72\x69\x70\x74","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x74\x79\x70\x65","\x74\x65\x78\x74\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74","\x73\x72\x63","\x66\x65\x65\x64\x73\x2F\x70\x6F\x73\x74\x73\x2F\x73\x75\x6D\x6D\x61\x72\x79\x3F\x73\x74\x61\x72\x74\x2D\x69\x6E\x64\x65\x78\x3D","\x26\x6D\x61\x78\x2D\x72\x65\x73\x75\x6C\x74\x73\x3D\x31\x26\x61\x6C\x74\x3D\x6A\x73\x6F\x6E\x2D\x69\x6E\x2D\x73\x63\x72\x69\x70\x74\x26\x63\x61\x6C\x6C\x62\x61\x63\x6B\x3D\x66\x69\x6E\x64\x64\x61\x74\x65\x70\x6F\x73\x74","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x3F\x73\x74\x61\x72\x74\x2D\x69\x6E\x64\x65\x78\x3D","\x65\x6E\x74\x72\x79","\x24\x74","\x70\x75\x62\x6C\x69\x73\x68\x65\x64","\x2F\x73\x65\x61\x72\x63\x68\x3F\x75\x70\x64\x61\x74\x65\x64\x2D\x6D\x61\x78\x3D","\x3F\x75\x70\x64\x61\x74\x65\x64\x2D\x6D\x61\x78\x3D","\x68\x72\x65\x66"];function loophalaman(_0x70d5x2){var _0x70d5x3=_0xc811[0];nomerkiri= parseInt(numshowpage/ 2),nomerkiri== numshowpage- nomerkiri&amp;&amp; (numshowpage= 2* nomerkiri+ 1),mulai= nomerhal- nomerkiri,mulai&lt; 1&amp;&amp; (mulai= 1),maksimal= parseInt(_0x70d5x2/ postperpage)+ 1,maksimal- 1== _0x70d5x2/ postperpage&amp;&amp; (maksimal-= 1),akhir= mulai+ numshowpage- 1,akhir&gt; maksimal&amp;&amp; (akhir= maksimal),_0x70d5x3+= _0xc811[1]+ nomerhal+ _0xc811[2]+ maksimal+ _0xc811[3];var _0x70d5x4=parseInt(nomerhal)- 1;nomerhal&gt; 1&amp;&amp; (_0x70d5x3+= 2== nomerhal?_0xc811[4]== jenis?_0xc811[5]+ home_page+ _0xc811[6]+ upPageWord+ _0xc811[7]:_0xc811[8]+ lblname1+ _0xc811[9]+ postperpage+ _0xc811[6]+ upPageWord+ _0xc811[7]:_0xc811[4]== jenis?_0xc811[10]+ _0x70d5x4+ _0xc811[11]+ upPageWord+ _0xc811[7]:_0xc811[12]+ _0x70d5x4+ _0xc811[11]+ upPageWord+ _0xc811[7]),mulai&gt; 1&amp;&amp; (_0x70d5x3+= _0xc811[4]== jenis?_0xc811[13]+ home_page+ _0xc811[14]:_0xc811[8]+ lblname1+ _0xc811[9]+ postperpage+ _0xc811[14]),mulai&gt; 2&amp;&amp; (_0x70d5x3+= _0xc811[0]);for(var _0x70d5x5=mulai;_0x70d5x5&lt;= akhir;_0x70d5x5++){_0x70d5x3+= nomerhal== _0x70d5x5?_0xc811[15]+ _0x70d5x5+ _0xc811[3]:1== _0x70d5x5?_0xc811[4]== jenis?_0xc811[13]+ home_page+ _0xc811[14]:_0xc811[8]+ lblname1+ _0xc811[9]+ postperpage+ _0xc811[14]:_0xc811[4]== jenis?_0xc811[10]+ _0x70d5x5+ _0xc811[11]+ _0x70d5x5+ _0xc811[7]:_0xc811[12]+ _0x70d5x5+ _0xc811[11]+ _0x70d5x5+ _0xc811[7]};akhir&lt; maksimal- 1&amp;&amp; (_0x70d5x3+= _0xc811[0]),akhir&lt; maksimal&amp;&amp; (_0x70d5x3+= _0xc811[4]== jenis?_0xc811[10]+ maksimal+ _0xc811[11]+ maksimal+ _0xc811[7]:_0xc811[12]+ maksimal+ _0xc811[11]+ maksimal+ _0xc811[7]);var _0x70d5x6=parseInt(nomerhal)+ 1;nomerhal&lt; maksimal&amp;&amp; (_0x70d5x3+= _0xc811[4]== jenis?_0xc811[10]+ _0x70d5x6+ _0xc811[11]+ downPageWord+ _0xc811[7]:_0xc811[12]+ _0x70d5x6+ _0xc811[11]+ downPageWord+ _0xc811[7]);for(var _0x70d5x7=document[_0xc811[17]](_0xc811[16]),_0x70d5x8=document[_0xc811[19]](_0xc811[18]),_0x70d5x9=0;_0x70d5x9&lt; _0x70d5x7[_0xc811[20]];_0x70d5x9++){_0x70d5x7[_0x70d5x9][_0xc811[21]]= _0x70d5x3};_0x70d5x7&amp;&amp; _0x70d5x7[_0xc811[20]]&gt; 0&amp;&amp; (_0x70d5x3= _0xc811[0]),_0x70d5x8&amp;&amp; (_0x70d5x8[_0xc811[21]]= _0x70d5x3)}function hitungtotaldata(_0x70d5x2){var _0x70d5x3=_0x70d5x2[_0xc811[22]],_0x70d5x4=parseInt(_0x70d5x3[_0xc811[23]].$t,10);loophalaman(_0x70d5x4)}function halamanblogger(){var _0x70d5x2=urlactivepage;-1!= _0x70d5x2[_0xc811[25]](_0xc811[24])&amp;&amp; (lblname1= -1!= _0x70d5x2[_0xc811[25]](_0xc811[26])?_0x70d5x2[_0xc811[27]](_0x70d5x2[_0xc811[25]](_0xc811[24])+ 14,_0x70d5x2[_0xc811[25]](_0xc811[26])):_0x70d5x2[_0xc811[27]](_0x70d5x2[_0xc811[25]](_0xc811[24])+ 14,_0x70d5x2[_0xc811[25]](_0xc811[28]))),-1== _0x70d5x2[_0xc811[25]](_0xc811[29])&amp;&amp; -1== _0x70d5x2[_0xc811[25]](_0xc811[30])&amp;&amp; (-1== _0x70d5x2[_0xc811[25]](_0xc811[24])?(jenis= _0xc811[4],nomerhal= -1!= urlactivepage[_0xc811[25]](_0xc811[31])?urlactivepage[_0xc811[27]](urlactivepage[_0xc811[25]](_0xc811[31])+ 8,urlactivepage[_0xc811[20]]):1,document[_0xc811[34]](_0xc811[32]+ home_page+ _0xc811[33])):(jenis= _0xc811[35],-1== _0x70d5x2[_0xc811[25]](_0xc811[36])&amp;&amp; (postperpage= 20),nomerhal= -1!= urlactivepage[_0xc811[25]](_0xc811[31])?urlactivepage[_0xc811[27]](urlactivepage[_0xc811[25]](_0xc811[31])+ 8,urlactivepage[_0xc811[20]]):1,document[_0xc811[34]](_0xc811[32]+ home_page+ _0xc811[37]+ lblname1+ _0xc811[38])))}function redirectpage(_0x70d5x2){jsonstart= (_0x70d5x2- 1)* postperpage,nopage= _0x70d5x2;var _0x70d5x3=document[_0xc811[40]](_0xc811[39])[0],_0x70d5x4=document[_0xc811[42]](_0xc811[41]);_0x70d5x4[_0xc811[43]]= _0xc811[44],_0x70d5x4[_0xc811[48]](_0xc811[45],home_page+ _0xc811[46]+ jsonstart+ _0xc811[47]),_0x70d5x3[_0xc811[49]](_0x70d5x4)}function redirectlabel(_0x70d5x2){jsonstart= (_0x70d5x2- 1)* postperpage,nopage= _0x70d5x2;var _0x70d5x3=document[_0xc811[40]](_0xc811[39])[0],_0x70d5x4=document[_0xc811[42]](_0xc811[41]);_0x70d5x4[_0xc811[43]]= _0xc811[44],_0x70d5x4[_0xc811[48]](_0xc811[45],home_page+ _0xc811[37]+ lblname1+ _0xc811[50]+ jsonstart+ _0xc811[47]),_0x70d5x3[_0xc811[49]](_0x70d5x4)}function finddatepost(_0x70d5x2){post= _0x70d5x2[_0xc811[22]][_0xc811[51]][0];var _0x70d5x3=post[_0xc811[53]][_0xc811[52]][_0xc811[27]](0,19)+ post[_0xc811[53]][_0xc811[52]][_0xc811[27]](23,29),_0x70d5x4=encodeURIComponent(_0x70d5x3);if(_0xc811[4]== jenis){var _0x70d5x5=_0xc811[54]+ _0x70d5x4+ _0xc811[36]+ postperpage+ _0xc811[31]+ nopage}else {var _0x70d5x5=_0xc811[24]+ lblname1+ _0xc811[55]+ _0x70d5x4+ _0xc811[36]+ postperpage+ _0xc811[31]+ nopage};location[_0xc811[56]]= _0x70d5x5}var nopage,jenis,nomerhal,lblname1;halamanblogger()
</script>
</b:if>




< br />













 

 

Pagination Code for Blogger: A Complete Guide

Pagination is an essential feature for blogs, especially when you have multiple posts and want to improve user experience by organizing content effectively. Blogger does not offer built-in pagination, but you can add a custom pagination system using HTML, CSS, and JavaScript. This guide will help you implement pagination in Blogger without any copyright issues.


What is Pagination?

Pagination allows users to navigate through different pages of your blog instead of loading all posts at once. This improves page speed and readability. Typically, pagination includes "Next" and "Previous" buttons, or numbered links to specific pages.

Benefits of Pagination in Blogger

  • Improves Navigation: Makes it easier for visitors to browse through older posts.

  • Boosts SEO: Helps search engines index posts better.

  • Enhances User Experience: Users can quickly find relevant content without scrolling endlessly.

  • Optimizes Load Time: Reduces the number of posts loaded on a single page.


Adding Pagination to Blogger

Step 1: Backup Your Blogger Template

Before making any changes, it's best to back up your Blogger template.

  1. Go to Blogger DashboardTheme.

  2. Click on Backup/Restore.

  3. Download your current template to avoid losing data.

Step 2: Add Pagination Script

Now, let's add a simple pagination script to your Blogger template.

1. Open Blogger Theme Editor

  • Navigate to Blogger DashboardTheme.

  • Click on Edit HTML.

2. Insert CSS Code

Find the <head> section and add the following CSS code before </head>:

<style>
.pagination {
  text-align: center;
  margin: 20px 0;
}
.pagination a {
  color: #333;
  padding: 10px 15px;
  margin: 5px;
  text-decoration: none;
  border: 1px solid #ddd;
  border-radius: 5px;
}
.pagination a:hover {
  background-color: #f4f4f4;
}
.pagination .current-page {
  background-color: #007bff;
  color: white;
  border: none;
}
</style>

3. Add JavaScript Code

Find </body> at the bottom and add the following JavaScript just above it:

<script>
function loadPagination() {
    var postsPerPage = 5; // Adjust the number of posts per page
    var numPages = Math.ceil(document.querySelectorAll('.post').length / postsPerPage);
    var paginationContainer = document.createElement('div');
    paginationContainer.className = 'pagination';
    
    for (var i = 1; i <= numPages; i++) {
        var pageLink = document.createElement('a');
        pageLink.innerText = i;
        pageLink.href = '#';
        pageLink.onclick = function(event) {
            event.preventDefault();
            showPage(Number(event.target.innerText));
        };
        paginationContainer.appendChild(pageLink);
    }
    document.body.appendChild(paginationContainer);
    showPage(1);
}

function showPage(pageNumber) {
    var posts = document.querySelectorAll('.post');
    var postsPerPage = 5;
    
    posts.forEach((post, index) => {
        post.style.display = (index >= (pageNumber - 1) * postsPerPage && index < pageNumber * postsPerPage) ? 'block' : 'none';
    });
}

document.addEventListener('DOMContentLoaded', loadPagination);
</script>

Step 3: Save and Preview

  • Click Save in the theme editor.

  • Visit your blog to see pagination in action!


Customizing the Pagination

If you want to change the pagination appearance, modify the CSS styles. You can adjust the background color, border, padding, and font size as per your preference.

To change the number of posts displayed per page, edit the postsPerPage variable in the JavaScript code.

Conclusion

Adding pagination to your Blogger site can significantly enhance user experience and site navigation. With a few lines of CSS, HTML, and JavaScript, you can create a professional-looking pagination system. Try implementing it on your blog today!

If you need further customization, feel free to modify the code as needed. Happy blogging!

Post a Comment

0 Comments