2008年4月7日

扩展发表文章(Expandable post summaries with Beta)

I came up with two better versions later. Use one of them instead of this older version.
1. One with which you can selectively make some of the old posts expandable i.e. only summaries will show up for them and clicking a "read more..." link will take you to the post page.
2. One that expands posts in the main page itself - Peekaboo style.]



Jornada left a comment in my blog that he found a blog which explained how to show expandable post summaries with Beta. Good thing about showing only post summary in the main page is that your readers can quickly find all that you have written about. Also, your blog gets an 'online journal'-like neat look. A "Read more" link is provided which takes them to the post page to read the entire post. Please note that you, as the author, have the flexibility to choose the portion of your post that appears as summary.


This hack is only an adaptation of Blogger's original instructions for expandable post summaries to Beta template. You can find Jornada's post about this here. I thought I will re-post the instructions with minor modifications for my readers.

<div class="post-header-line-1">

<div class="post-body">
<span style="font-weight: bold; color: rgb(255, 0, 0);">
<b:if cond="data:blog.pageType == "item"">
<style>.fullpost{display:inline;}</style>
</b:if><p><data:post.body></data:post.body></p>
<b:else>
<style>.fullpost{display:none;}</style>

</b:else><p><data:post.body></data:post.body></p>

<a style="color: rgb(255, 0, 0);" href="data:post.url">Read More......</a>

</span>
<div style="clear: both;"> <!-- clear for photos floats -->
</div>



Step 2. Goto Settings->Formatting and at the bottom, you will find the text box provided to specify the "Post template". Copy/paste these lines into that text box and save the settings.


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



If you create a new post now, it shows you clearly where to type the summary and where to add the rest of the post. Follow the format and only summary will show up in your main page. Please note that you also need to divide your old posts like this (atleast the ones showing up in main page) into summary and full portions by editing them.

没有评论: