Feb 12, 2007

Expandable posts with Peekaboo view

Your blog's main page usually shows the entire content of each post. If your posts are usually more than 2 paragraphs, then your visitor will find it difficult to quickly find the topic of interest to him because he needs to scroll down a lot. This is where expandable post summaries helped in the old Blogger. This hack serves the same purpose for the new Blogger and more! That is, main page will show only post summaries and when you click "Read more", the full post appears in the main page itself (Peekaboo view)!! I got some requests to do such a hack and I managed to get it working. Later, Hans improved it by adding a "Summary only" link with which you can collapse the post back to summary. Together, we also made the "Read more" link to show up only for the posts that have a summary. This is an amazing hack but you need to be careful while changing your template. If you are not familiar with HTML, I strongly suggest you to get help from somebody who knows HTML while applying this hack. Here are the steps to follow.

Step 0: Download and save your template so that you can go back to it if there is any problem with this hack (Important!)

Step 1: Find the



tag in your template and add this line before it (if you have not already done so).





Step 2: Find the includable called 'post' (you could search for the term id='post') and copy/paste the changes highlighted in red in this page (be very careful and avoid mistakes). Note that the word uncustomized-post-template may not appear in your template but that's fine.

Step 3. 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. (Please DON'T type these lines yourself because you might introduce some spaces that will break the functionality)

Type your summary here

Type rest of the post here


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. It is important to make sure that the /span tag above is at the end of the post. To ensure this, use Edit Html tab instead of Compose tab while typing the post. After typing, you can go to compose mode and change fonts/colors etc. Please note that you could also divide some (or all) of your old posts into summary and full post by editing them. The "Read more" link will appear only for the posts that have been divided like this.

Update 1: If you are not able to find the lines to change (such as id='post'), you may not have expanded the template. Select the checkbox named "Expand Widget Templates", which is right above the template code, to expand it into more code. If you don't find that checkbox itself, you must be using the classic Blogger template. This hack won't work with that.
Update 2: If you click "Older posts" link, the "Read more" link may appear even for the posts which you haven't divided into summary and full post. This is a known problem which we haven't solved yet.
Update 3: If you would like the "Read more" link to take you to the post page instead of expanding in the main page itself, use this other hack.

::source: http://hackosphere.blogspot.com

Related Posts




0 comments:

Post a Comment

Google