Tuesday, July 8, 2008

Expandable Posts, Part 2

I've re-ordered all the "work in progress" posts so they flow chronologically. It occurred to me that the excerpt code can be used to pull text out of anywhere in a post, so the "in progress" dilemma is solved. I tested this out on the Angel Rebirth wip and it works very well, so I've updated all older wips to follow.

So, what was the problem? The blogger platform necessarily places the most recent entries on top, so "in progress" posts which are frequently updated were done in reverse (i.e. the newest updates would be visible on top). With excerpts, I can simply pull out the last update to the front/index pages without needing to worry about its order. So now all the wip pages flow nicely from start to end, yet when the post is updated, the latest update will still show on the front page! Yeah!

While the Blogger expandable post page explains putting the "summary" text outside the span, the code itself doesn't care where the spans are nor how many there are. So, this little trick works for any frequently updated post. Just add multiple spans around any text you want to hide and what's left will be shown on the front/index pages, regardless of where it is in the post.

By default, the read more link jumps to the start of the post, but we can get it to jump to the excerpt by adding a navigation label "#more" to the template:


<a expr:href='data:post.url + "#more"'>read more</a>


If there's no "#more" label in the post, this still jumps to the start. Optionally, for really long posts, insert the label before the excerpt and we'll jump to it instead:


<a name="more"></a>


No comments:

Gallery Links

Pinky Rin Archer Schpeltor Mikuru Asahina Angel Rebirth Moyashimon Satsuki Ikaruga Yuki Nagato Pinky:St Saber Mina Tsukishiro Haruhi Suzumiya

About This Blog

My photo
Sunnyvale, California, United States

A blog of my hobbies and a place to show progress and finished models. Galleries are embedded as slideshows to reduce page load time, but you can open any album by clicking on its label.

dannychoo.com

figure.fm

Akiba-Station

Through the Looking Glass