Friday, October 3, 2008

How to add expandable post summaries to blogger

Expandable post summaries are where a summary of the post is given or a teaser paragraph and then a link to the full post is given such as 'read more...' or 'continue reading...'
I am going to show you how to add this to your blog

The first step is the usual one of backing up your blogger template and then check the expand widget templates box.
1.Now search for the </head> tag and paste the following code BEFORE it

<style>
<b:if cond='data:blog.pageType == "item"'>
span.fullpost {display:inline;}
<b:else/>
span.fullpost {display:none;}
</b:if>
</style>

2.Once that is done search for the code <data:post.body/> and then paste the following codes AFTER it

<b:if cond='data:blog.pageType != "item"'>
<span>
<a expr:href='data:post.url' style='color:#0000FF; text-align:right; font-weight:bold; text-decoration:none;'>Read more...</a>
</span>
</b:if>

You can customize the read more link to any text you want by changing the part of the code in blue and you can change the colour of the link by changing the hex value in green

3.Save the template and then go to the settings tab and under the formatting sub tab
go to post template and add the following code

Type your summary here.
<span class="fullpost">
Type rest of the post here
</span>

Now the purpose of this code is to differentiate the summary and the rest of the post.Replace your summary with the text in blue and then the rest of your post with the text in green.I hope you have understood how it works.If you get any problems just ask me and I will help you out.

UPDATE:For those of you using classic templates(templates written in HTML)use this code instead of the first code
<style>
<MainOrArchivePage>
span.fullpost {display:none;}
</MainOrArchivePage>

<ItemPage>
span.fullpost {display:inline;}
</ItemPage>
</style>

AND then search for <$BlogItemBody$> and add the following code after it.

<MainOrArchivePage><br />
<a href="<$BlogItemPermalinkURL$>">Read more!</a>
</MainOrArchivePage>

7 comments:

  1. I wasn't able to find the place where I should put the second code which put the "Read more" link. I already place the first code. And also the last code. Can you please tell me why I can't seem to find this tags where I supposed to insert the second code? And how can I really make it work? Please. I really appreciate any help. Thanks in advance.

    ReplyDelete
  2. Most likely you have a classic template and that is why you could not find the place as classic layouts are written in HTML unlike XML templates which are the most common.Try looking for this code instead <$BlogItemBody$>.If it still does not work contact me and I will give you my email and you can email me your template and I will add it for you.

    ReplyDelete
  3. Yeah your right I am using classic template that came from blogspot site. I already make it work with new templates using the guide you post, thanks you, but I have also used classic template on my other blogs and that's where the problem was. For now I try the one on the reply you had for me. If I still having hard time I surely contact you again. Thank you very much for the big help, I really appreciate it. Later then. God bless you....

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. I know the problem,don't worry I will update this post tomorrow with the necessary code as i cannot write it here in the comment so check back tomorrow.
    If you want to remove your navbar just look for the HTML code and remove it e.g if your navbar has the ID headernav just search for the HTML code that starts with div id='headernav' and carefully delete the code after it.If you are not sure just send the template to chillichilli3000@yahoo.com and i will do it for you.

    ReplyDelete
  6. Thank you very much. You're a great person. God bless you.

    ReplyDelete
  7. I think I already made everything worked. It's really stressful nonetheless I made it through. Thanks to for the help anyways. I really appreciate it. I hope you won't stop helping people in need like me. God bless you.

    ReplyDelete

Feel free to leave a comment here