Quite recently, I post guide for summarizing blog post on main page. The purpose of using this hack is you can display more post at your front page without clogging the layout with too many posts and texts. Thus, you will maintain a clean and easy to read page content.
There are actually two types of summarizing your post. The first hack, will provide you link at the bottom of summarize post and once clicked you will directed to the post page of the topic desired.
While, the second on will expand/collapse your post on the page itself. You can check out both hacks here :
The advantage of using this hack is
- You no longer need to edit your post with span command to divide between full and summarized
- Expanding post are equipped with smooth transition (i recommend older hack if you are planning for this, they have fade effect too and proper alignment on collapse mode)
- You can manually select the length of your post by characters.
jQuery Expander Plugin
Step 1 - Back up your original template
- Whenever your tries to customize your blog template ALWAYS save the original template into your computer. In case of anything goes wrong either with the code or the after-effect are worse, you can always revert back to the original template before you applied the editing.
- To back-up your Blogger template, go to Layout > Edit HTML and click on the "Download Full Template" link near the top of the page. You will be prompted to save a copy of your blog template as an XML file to your computer. Be sure to save this to a location where you can easily find it if required.
- To restore to the original setting (before editing), simply upload the template using the upload form located on the same page.
- Or, a quick method I always use. Check Expand Widget Template option and copy all the text (Ctrl + A) in the scroll bar box and save it onto any simple text application (Notepad, Wordpad, etc). In case of mishap, simply reverse the process. - useful when you are going to restore in between editing time.
- This are for the expand/collapse hack | i want post page method
- Find the </head> tag (use Ctrl + F on Firefox for quick find), and paste the following code BEFORE the tag.
<script language='javascript' src='http://halotemplates.s3.amazonaws.com/jquery-truncator/jquery-1.2.3.pack.js' type='text/javascript'/>
<script language='javascript' src='http://halotemplates.s3.amazonaws.com/jquery-truncator/jquery.expander.js' type='text/javascript'/>
<script type='text/javascript'>
$(document).ready(function() {
$('.excerpt').expander({
slicePoint: 280, // default is 100
expandText: '[...]', // default is 'read more...'
});
});
</script>
- Next, find the following codes (or similar) ;
<data:post.body/>
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>
- And replace all with these following codes :
<div class='excerpt post-body entry-content'>
<data:post.body/>
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>
<b:else/>
<div class='post-body entry-content'>
<data:post.body/>
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>
</b:if>
- Preview your template and save upon success
- Skip to Step 3
- Find the </head> tag (use Ctrl + F on Firefox for quick find), and paste the following code BEFORE the tag.
<script language='javascript' src='http://halotemplates.s3.amazonaws.com/jquery-truncator/jquery-1.2.3.pack.js' type='text/javascript'/>
<script language='javascript' src='http://halotemplates.s3.amazonaws.com/jquery-truncator/jquery.extractor.js' type='text/javascript'/>
<script type='text/javascript'>
$(document).ready(function() {
$('.excerpt').expander({
slicePoint: 280, // default is 100
expandText: '[...]', // default is 'read more...'
});
});
</script>
- Next, find the following codes (or similar) ;
<data:post.body/>
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>
- And replace all with the following codes :
<div class='excerpt post-body entry-content'>
<data:post.body/>
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>
<a expr:href="data:post.url">Continue Reading</a>
<b:else/>
<div class='post-body entry-content'>
<data:post.body/>
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>
</b:if>
- You can change this to desired text
- Preview your template and save upon success
- Take note on code your applied on </head> mentioned on Step 2. You will notice these codes :
slicePoint: 280, // default is 100
expandText: '[...]', // default is 'read more...'
});
- This can be customizable to your liking. And also other few available options.
That's all. Thank you and happy tweaking.
More topics on ikmalTips.
1 comments:
it works on Firefox but it doesn't on IE. why?
Post a Comment
Want to be notify on comment reply? Subscribe to: Post Comments