There are a number of strategies available to get this done.... by the end of this post I'll probably wish I was using one of them!
Blogger themselves offer a couple of different strategies for this. The expandable post summaries hack uses conditional tags, wraps the part of your post that you want to hide in a special span tag (which you can add to the post template so that it is always there waiting for you), and only shows it on the post page. The "read more" link is really a link to the post page. Quoting Blogger for the pros & cons:
- Advantages to this method: Customizable summaries, rather than titles only. Can be applied to some posts and not others (for instance, you might only want this for your longer posts).
- Disadvantages: Requires changes to the posts themselves, rather than to the template only. However, the "read more" link is in the template, so it will appear regardless of whether a post has been truncated or not. (Modifying this feature is left as an exercise for the reader.)
Aditya at The Last Word offers an alternative method. It allows for a teaser-section of your post as a supplement to your title, & so stands a better chance of hooking your readers. It works inline too, popping open the post on your main page instead of sending your readers off to the post page. The main upgrade, though, is that the "expand this post" link won't appear on posts that are not abbreviated, and therefore do not require expansion. On the downside, once the post has been expanded, you're not currently able to collapse it again. Aditya offers a script for the head of your template, & asks you to wrap the part of your post that you're hiding in a tag that the script can see. This also requires a minor change to your body tag, & the wrapping of your blog post content in a div tag, so that the script knows where to make its magic happen.
Julie at No Fancy Name offers a hack that has a similar outcome, & being a wordsmith of the first order, lays out the goodies in a way that will make sense to you if you still think Java is an island in the ocean somewhere.... (I read that once....) What is nice (not to say suh-weet) about Julie's hack is that the "read more" button only appears on posts where there is more to read, and it is joined by a "back to the main page" button when it activates itself. This means that even if you're a main page all-post-reading browsing sort of a visitor, all is not lost when you find yourself on a post page. Cool.
So, my advice is to toss the default hacks, & decide whether you want "on-page pop-out" expansion, or "link to the post page & link back" buttons.
Let me know what works, & let me know if you're working this out a different way.
Update: Gaby from Blogger Categories has a cool how-to / demo combination post that lays out another way to do this. Where you see >> links in his post, you can pop out more content. You can also click again to collapse the post. There's a script & some CSS for your template head, and some "use it as often as you like" HTML that could go in Blogger's post template if you were so inclined. All good stuff. Thanks for sharing, Gaby!
Filed in: blogger blogtech webtech blogger-hacks
You should probably start off here:
http://categories.blogspot.com/
Then read more>ยป
http://categories.blogspot.com/2005/12/how-to-make-expandable-post-zones.html
Here is another method.
http://categories.blogspot.com/2005/12/new-link.html
Have fun :-)
Instead of putting their [span class= yada yada] [/span] stuff in the template, I enclose what I want hidden in my post in that code, changing the "$BlogItemNumber$" stuff to an individual name for my post.
Then I put the link ([a href="javascript:expandcollapse('name here')"] at the end of the post.
What this does is allow an expandable post right on the main page, instead of jumping to a post page. It also shows the link only on the posts that I want to expand, and I can choose how much I want hidden.
One drawback that Aditya noticed was that the link is still present on the post page, when it really isn't needed, and it requires more code to add to your post than just the [hide][/hide] that he is working on.
All in all, however, I find the drawbacks minimal compared to the benefits.
We are the interface to the backend, which they don't need to see or understand! :)
@Gaby: Its been a long while since you showed yourself to the world. Roberto and I could do with your hand in these things! Wanna take a look at my code and make something better out of it? Link! :)
One thing about the process I wrote about is that it is most decidedly used predominantly by people with zero skills in html or javascript or template tags, etc. which is exactly the group of people I aim to help. Doesn't matter if it's not the most cool or hackery way, it's (so far) the one that people's grandmothers can follow--always a good test.
Intersting suggestion, I didn't care because I have 10 posts per page. But it would be nice to have indeed.
I've hidden a java applet (afternet irc) and some flash films (google video) Now they do-not load if-not expanded! One can add as manny videos to a single post as you want. O_O
[link]
juzten
http://dailyfreesoftware.blogspot.com