Maryland Blogger Alliance

Alliance FAQs

Latest MBA Posts


May 09, 2006

Expandable posts on Blogger

Hey, all you guys out there in Bloggerland!

Ever think about doing expandable posts, the way people with other blogging hosts can do? You know, those thingies with "Read more" at the bottom, where you click and open up a longer post? Well, don't bother with Blogger's official "hack" here. Any hack that tells you it has a bug (which it calls a "feature") and says that "[m]odifying this feature is left as an exercise for the reader" should be avoided. It reminds me of when I studied math in college. The proofs would often leave out something important, and the texts would say that proving what was left out was an exercise for the reader. Thanks a bunch!

I've researched the expandable post problem and have discovered an elegant solution at a blog called No Fancy Name. I've used this solution at Pillage Idiot, and I want to demonstrate it here. Please note that I didn't create the buttons described at NFN, so you'll have to hit the "back" button of your browser to go back to the main page.

Anyway, I have put the first few paragraphs of the solution in the expanded post.

Here they are:

If you're a Blogger user and have always wanted to use expandable posts, you've come up short. Or, if you're Scrivener, you asked me how to do it and then I didn't get around to writing a post about it for months. The Blogger Help entry, "How can I create expandable post summaries?" leaves something to be desired, especially for users unfamiliar with DOM, CSS and JavaScript—you know, most of the Blogger user base.

What I've compiled is a post that shows one method for achieving expandable posts in Blogger, so that the link to "read more" (or whatever text you use) is only shown in a post when you decide to show it. I did not come up with the JavaScript snippet—I got it from this fellow and just added a very wee bit of info and explained what the code was doing.

The information in this post may not work for everyone. I have not tested it backwards and forwards and inside out (shame on me), but I have tested it in Firefox and IE; caveat emptor. Before you get started, be sure that "post pages" are selected in your Blogger settings.
Many thanks to Julie at No Fancy Name.