Splitting a long blog post in Blogger into multiple pages

How to split long blog post in Blogger into multiple pagesAfter publishing this article on splitting wordpress posts into multiple pages few folks asked us about doing it in Blogger that is to split long blog post into multiple pages in Blogger. Splitting posts in wordpress is very simple and there are many plugins to achieve this, but how it’s done in Blogger. In Blogger there is no build in feature to split posts or pages and there are no widgets to paginate, but by using a simple jQuery function you can paginate your blog posts. So why to split a blog post? We have already discussed all the benefits of adding pagination to blog posts in this article. Here we will show you how to split long blog post in Blogger into multiple pages.
Don’t panic, the code below is simple and easy to understand. Assume that you are about to publish a long blog post and would like to split that into 4 pages. Here is how you do that in just 3 simple steps.

How to split long blog post in Blogger into multiple pages

Step 1: Usually you will edit your post in compose mode, but this time you are going to do this in HTML mode. Switch to HTML editor, add the span element that you see below and add your blog content in each element respectively. From the below lines you can see that only 1st page content is visible and the remaining 2nd, 3rd and 4th pages are hidden. So the remaining pages will be visible only if the visitor navigates.
1<span class="content1">
2Add your first page content here
3</span>
4<span class="content2" style="display:none">
5Add your second page content here
6</span>
7<span class="content3" style="display:none">
8Add your third page content here
9</span>
10<span class="content4" style="display:none">
11Add your final page content here
12</span>
Step 2: Hope you have added your content. Now you have to create page links so when a user clicks on that page he or she should get that particular content. Just below to the above code add this one which adds Pages: 1 2 3 4 links below your post content.
1<p><b>Pages: <span style="color: #3d85c6;">
2<a href="#" class="page1">1</a>
3<a href="#" class="page2">2</a>
4<a href="#" class="page3">3</a>
5<a href="#" class="page4">4</a></span></b></p>
Step 3: Next to make this links to work add the following script just below the pagination links.
1<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
2 
3<script style="text/javascript">
4jQuery(document).ready(function(){
5jQuery('.page1').click(function(){
6jQuery('.content1').show();
7jQuery('.content2').hide();
8jQuery('.content3').hide();
9jQuery('.content4').hide();
10return false;
11});
12jQuery('.page2').click(function(){
13jQuery('.content1').hide();
14jQuery('.content2').show();
15jQuery('.content3').hide();
16jQuery('.content4').hide();
17return false;
18});
19jQuery('.page3').click(function(){
20jQuery('.content1').hide();
21jQuery('.content2').hide();
22jQuery('.content3').show();
23jQuery('.content4').hide();
24return false;
25});
26jQuery('.page4').click(function(){
27jQuery('.content1').hide();
28jQuery('.content2').hide();
29jQuery('.content3').hide();
30jQuery('.content4').show();
31return false;
32});
33});
34</script>
That’s it! When everything is done publish your article and view it where you will see page links below the content. Just click on the links to see how it works. Hope that helped you to split long blog posts in Blogger into multiple pages. Got any questions? Feel free to ask below in comments section.
Share on Google Plus

About Education

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

0 comments:

Post a Comment