Feb
28th

How to Make an Expandable Post in Blogger (Blogspot)?

<
Author: Joliber Mapiles | Files under Tutorial, Blogging Tips

Sometimes, we tend to publish 3 or more posts daily. In effect, due to very long entries, the other post will likely be invisible to the readers. At some instances, the blog owner is forced to create navigational links on the sidebars or even near the header just to expose other articles. Certainly, this requires effort on the part of the blogger.

As a matter of fact, this has been my case. Although I like the idea of exposing my other post both on the sidebar and header, still, I want to have a newspaper like blog wherein the top stories are highly visible. This is the reason why I decided to search the net on how to have expandable post.

Luckily, I found many articles through the search engine but I’ve chosen this simple tutorial from It’s A Fun. And now, you can even attest through my blog if this tutorial has been effective. Absolutely, the tutorial has served it’s purpose.

Below is the complete steps to “Make an Expandable Post in Blogger (Blogspot)”

Pre Requisite: Make sure you have enabled post pages.

1. Go to your blogger setting panel >> Template >> Edit HTML

2. Back-up your template first by clicking “Download Full Template” link (this is a best practice).

3. Check on “Expand Widget Templates”

4. Search for </head> & replace it with following javascript code:

<script type=’text/javascript’>
function truncate_body (postid) {
var id = document.getElementById(postid);
var postbody = id.innerHTML;
var len = postbody.toLowerCase().indexOf(”<br”);
if(len>0)
postbody = postbody.substring(0, len);

id.innerHTML = “<p>” + postbody + “</p>”;
id.style.display=”block”;
}
</script>
</head>

5. Search for <p><data:post.body/></p> & replace it with following code:

<b:if cond=’data:blog.pageType != “item”‘>
<div expr:id=’”postid_” + data:post.id’>
<data:post.body/>
</div>
<script type=’text/javascript’> truncate_body(”postid_<data:post.id/>”); </script>
<p>
<a class=’read_more’ expr:href=’data:post.url’><b>Read More…</b></a>
</p>
<b:else/>
<p><data:post.body/></p>
</b:if>

Yes, that’s all. If you have any problem implementing this solution feel free to leave a comment and I’ll get back to you. If you think this will be helpful to our fellow bloggers just link them to this site.


Related Posts:

RSS feed | Trackback URI

21 Comments »

Comment by Jen
2008-02-28 11:32:00

Grabe Joliber! Champion ka! Salamat ng marami! Did it to my blogger accounts na. Very helpful! This is actually the first time I tried tweaking my template without messing up. Thanks to you! :-)

Comment by Joliber Mapiles
2008-03-12 07:51:38

Thanks Jen.. Nice to hear that you were able to implement it successfully..

 
 
Comment by Jen
2008-02-28 11:34:00

Nga pla, Joliber, wala tlaga itong option na ako mismo magse-set where the post will be cut?

Comment by Joliber Mapiles
2008-03-12 07:50:38

I’ll try to research that.. That code only cuts from the first paragraph.. So if it happens that your paragraph is one sentence, then it will cut from there..

 
 
Comment by Farah Deen
2008-02-28 12:35:00

Joliber, this is good. I found out the code to this this a few weeks back too, and I love it. good tip!

Comment by Joliber Mapiles
2008-03-12 07:52:09

yeah, i love it too..

 
 
Comment by Scotty's Princess
2008-02-28 12:47:00

WOW! Congrats Joliber for a job well done! I know u have been trying real hard to find out about this feature and finally, successful! I will try to do this too in my page, will let you know when im done.

P.S. How’s basketball last night? Hope you turned out the champions!

Comment by Joliber Mapiles
2008-03-12 07:52:37

I hope you can successfully implement it..

 
 
Comment by Lorie
2008-02-29 02:06:00

Wow! Salamat sa info mo about this one. Matagal ko ng gusto ito di ko lang alam gawin but now I’ve done it!

Salamat Joliber!

Comment by Joliber Mapiles
2008-03-12 07:53:20

I’m so happy that you have implemented it successfully..

 
 
Comment by Earvin
2008-02-29 07:25:00

WAAAAAAAAAAAAAAAAAAAAAHHHHHHHH. Buong akala ko hindi pwedeng gawin yan sa Blogger, pwede pala! Yay! Salamat Kuya - ang helpful!

Comment by Joliber Mapiles
2008-03-12 07:53:59

Hi Earvin, hope you can implement it successfully, just contact me if you have any problem concerning the codes..

 
 
Comment by Scotty's Princess
2008-02-29 15:04:00

Too bad it’s not successful in mine, sigh!

Comment by Joliber Mapiles
2008-03-12 07:56:02

I’ll get back to you ate ellaine..

 
 
Comment by ceblogger
2008-02-29 16:46:00

i tried the hackosphere version for my blogspot but to no avail. will try again using this one.

it’s easy with the wordpress i’m currently using.

Comment by Joliber Mapiles
2008-03-12 07:55:34

Just let me know if you have made it successfully..

 
 
2008-03-26 06:45:52

[…] Must read for blogspot (blogger.com) friends.How to Make an Expandable Post in Blogger (Blogspot)?Blogger.com Malware Attacks | Move or Be Deleted in the Blogosphere Social […]

 
Comment by Earvin
2008-03-26 07:39:20

HALA. Hindi ko makita yung code sa second step! Help!

Earvin’s last blog post..KG in Lucban: The Super Holy Week Gig!

Comment by Joliber Mapiles
2008-03-26 08:54:49

Hi Earvin, hindi code yung second step, link lang siya sa upper part ng “Edit Template” na page.. add mo ako sa ym: joliber_kid@yahoo.com if you still have problems..

Comment by Earvin
2008-03-27 12:22:01

Waaah. Iba ata. Kuya di ko talaga ma-gets yung Step 2 kasi di ko makita ang link na dapat i-replace.

Earvin’s last blog post..A Darker Carrot Prince.

(Comments wont nest below this level)
Comment by Joliber Mapiles
2008-03-28 09:18:38

Hi Earvin don’t be confused.. Step 2 requires no coding at all.. The only purpose of that step is two back-up your template, but if you are sure you can manage the changes w/o backing up, then proceed to step 3..

But then again, I recommend to go through step 2.. If you have any problem don’t hesitate to pm me at ym, joliber_kid@yahoo.com..

 
 
 
 
Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> in your comment.