Skip to main content

How to Create an Automatic PageBreak on Blogger

In the default, Blogger has provided the simplest method in creating a pagebreak or read more function in Blogger post editor. As you can see on the top navigation bar of Blogger post editor, a new button with a “ripped paper” icon has been added to make a pagebreak function on articles, which later will manually cut the full body content of your new post and serve only the first paragraph on your blog homepage.

But if you look at some blogs across the blogosphere, the pagebreak on those blogs are already set up as an auto pagebreak, where you won’t need anymore to press the pagebreak icon in post editor in order to make a pagebreak function. Well, that was the reason why I decided to test drive this cool auto pagebreak feature on my testing blog. Out of the blue, I managed to make it worked in the second attempt on that testing blog. Interested to know the trick? Read on.

Oh.. wait.. before proceeding to the steps below, I just want to tell you that, I am currently using Minima template on my testing blog.  Okay, here you go.

1. Enter you Blogger account
Now head on to Blogger.com and sign in to your account.

2. Go to Edit HTML
In the Dashboard, pick out your blog and go to Design/Layout > Edit HTML.

3. Expand the widget template
When landing to the Edit HTML page, you will see a small box with the sentence “Expand Widget Templates”. Now press it.

4. Make a back up template
Okay, before making any attempt to edit your blog template, I strongly insist you to make a back up template, just in case if later, you want to revert back the template to the first condition.

5. Look around for the code
Okay, now let’s play around with the code template. By pressing Ctrl + F, now find the code below:

</head>

6. Stack a new script code
After locating the code on number 5 above, now copy the script code below and paste it above the code </head>:
<script type='text/javascript'><!--//--><![CDATA[//><!--
function removeHtmlTag(strx,chop){
    if(strx.indexOf("<")!=-1)
    {
        var s = strx.split("<");
        for(var i=0;i<s.length;i++){
            if(s[i].indexOf(">")!=-1){
                s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);
            }
        }
        strx =  s.join("");
    }
    chop = (chop < strx.length-1) ? chop : strx.length-2;
    while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;
    strx = strx.substring(0,chop-1);
    return strx+'...';
}

function createSummaryAndThumb(pID){
    var div = document.getElementById(pID);
    var imgtag = "";
    var img = div.getElementsByTagName("img");
    var summ = summary_noimg;
    if(img.length>=1) {   
        imgtag = '<span style="float:left; padding:0px 10px 5px 0px;"><img src="'+img[0].src+'" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></span>';
        summ = summary_img;
    }
   
    var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>';
    div.innerHTML = summary;
}

//--><!]]></script>
  <script type='text/javascript'>

var thumbnail_mode = &quot;no-float&quot; ;
summary_noimg = 530;
summary_img = 440;
img_thumb_height = 120;
img_thumb_width = 180;
</script>

7. Find the blog post code section
Press Ctrl + F again and search for the code section that controls the occurrence of blog post on the homepage below:
<div class='post-header'>
    <div class='post-header-line-1'/>
    </div>

    <div class='post-body entry-content'>
      <data:post.body/>
      <div style='clear: both;'/> <!-- clear for photos floats -->
    </div>

    <b:if cond='data:post.hasJumpLink'>
      <div class='jump-link'>
        <a expr:href='data:post.url + &quot;#more&quot;' expr:title='data:post.title'><data:post.jumpText/></a>
      </div>
    </b:if>

8. Replace the code section
Okay, this is the trickiest part from the whole steps. After locating the whole code sections on number 11 above, now block those code sections and then replace it by using the new code sections below:
    <div class='post-header'>
    <div class='post-header-line-1'/>
    </div>

<b:if cond='data:blog.pageType != &quot;item&quot;'>
    <div class='post-body entry-content'>
      <div expr:id='&quot;summary&quot; + data:post.id'><p><data:post.body/></p></div>
<script type='text/javascript'>createSummaryAndThumb(&quot;summary<data:post.id/>&quot;);</script>
      <div style='clear: both;'/> <!-- clear for photos floats -->
    </div>
</b:if>

<b:if cond='data:blog.pageType == &quot;item&quot;'>
<p><data:post.body/></p>
</b:if>
<div class='singleinfo'>
<div class='readmore'> <b:if cond='data:blog.pageType != &quot;item&quot;'><a expr:href='data:post.url'>Read More</a>
</b:if></div>
</div>

9. Save the template
Okay, you’re done. Now save all the changes of your blog template and see the result.

As you can see on your blog, without the pagebreak function from Blogger, all of your latest posts on the homepage will automatically appear in half, and only the first paragraph will be displayed to your blog.

What do you think? Is this pagebreak trick working or not? Got any problem implementing this pagebreak on your blog, feel free to leave your question below, and let me help you with that.
And if you liked this post, please consider sharing it. Thanks!

 Source:Internet

Comments

Popular posts from this blog

Toyota has made a SpongeBob SquarePants minivan

Who wants a red Ferrari when you could have a bright yellow SpongeBob SquarePants-themed set of wheels to impress your friends – and make fellow road users green with envy – with? If you love SpongeBob (or even if you don’t), this is the ultimate piece of fan merch you simply need to get your hands on. To celebrate the release of the SpongeBob movie in 2015, Nickelodeon and Toyota have teamed up to create the car-of-all-cars – the SpongeBob Toyota Sienna minivan. Currently on display at the 2014 Los Angeles Auto Show, it has SpongeBob’s classic bright yellow exterior, character-themed seats and the coolest wheel you’ve ever seen.

5 fabulous ways to tie headwrap (Gele)

        What is a "Gele"? "Gele" is a Yoruba {Nigeria, West Africa} word for a female Headwraps usually worn at occasions such as weddings. ...the inseparable fashion accessory of the African woman.. The "Back to Front" Style: 1. Fold the material depending on its width to make sure if covers the entire hair {how much you fold this material depends on its width} 2. Stand in front of a mirror or a friendly guide 3. Hold the material with the folded part away from your face. 4. Place the material over your hair/head. 5. Adjust the material so its middle is at the base of your neck. In doing so you will have two ends of material. Holding your head up, look straight ahead, grab the right end of the material midway to the end with your right hand and hold on to while grabbing the left end of the material with your left hand. 6. Hold the ends close together with your thumbs, allowing the rest of your fingers to be free. ...

Download: The Hobbit: The Battle of the Five Armies (2014)

UPDATED          The Company of Thorin has reached Smaug’s lair; but can Bilbo and the Dwarves reclaim Erebor and the treasure? And, if so, can they hold on to it?             Having reclaimed their homeland from the Dragon Smaug, the Company has unwittingly unleashed a deadly force into the world. Enraged, Smaug rains his fiery wrath down upon the defenseless men, women and children of Lake-town. Obsessed above all else with his reclaimed treasure, Thorin sacrifices friendship and honor to hoard it as Bilbo’s frantic attempts to make him see reason drive the Hobbit towards a desperate and dangerous choice. But there are even greater dangers ahead. Unseen by any but the Wizard Gandalf, the great enemy Sauron has sent forth legions of Orcs in a stealth attack upon the Lonely Mountain. As darkness converges on their escalating conflict, the races of Dwarves, Elves and Men must decide – unite or be destroyed. Bilbo finds h...