« The 2008 Elections – Indexed for your reading pleasure… | Main | Now that we’ve solved that problem, the Really Big Survey… »
Post Breaks in Blogger – The Real Answer
By Brian | February 10, 2008 | Share on Facebook
The other day, Jason Bennion posted a blog meme called the Really Big Survey, consisting of 148 random questions about his life. Then Ilya posted it as well. I was going to participate, but demurred because I don’t have Post Break logic in Blogger (you know, where the first part of the post is visible on the main page, and then you click through to read the rest?), so 148 questions would push every other post in the blog to the archives.
Then, I started thinking, “Well why the heck don’t I have Post Break logic in Blogger?” Enter my good friend, Google.
The most definitive entry on the topic was this one from Blogger’s own help pages. It gives very detailed instructions about adding the Post Break to your main page, and then hiding the rest of the post’s text until the user clicks through to the detail. I eagerly implemented the fix, but soon realized that by modifying the blog template the way they did, the Post Break link wound up appearing on every single post, whether there was more text behind it or not.
Since the convention is to put that link only on posts that have more to read, I deemed this result unacceptable. On the upside, however, the instructions gave me enough of an understanding of how the logic works to write it myself. And so, (drumroll, please…) if you’d like to know how to put Post Break logic in your Blogger blog…
Post Breaks in Blogger
The first thing you’ll need to do is modify your blog template. In the style section of the template (between the <style> and </style> lines, put the following two text blocks:
<MainOrArchivePage>
span.blog_afterbreak {display:none;}
span.blog_beforebreak {display:inline;}
</MainOrArchivePage><ItemPage>
span.blog_afterbreak {display:inline;}
span.blog_beforebreak {display:none;}
</ItemPage>
If your template already has tags like <Itempage> and </Itempage> (mine did), then don’t repeat them – just put the “span” commands in between them.
OK, now you’re ready to go. When you create a post, type the beginning portion (that is, the portion you want to appear on the main blog page) as you normally would. When you’re ready to do a Post Break, type this:
<span class=”blog_beforebreak”>Continue reading this post</span>
<span class=”blog_afterbreak”> The rest of the post’s text…
Anything in the “beforebreak” span only appears on the main page, not the individual post page. Anything in the “afterbreak” span only appears on the individual page, not the main page. So what we’ve done here is put the “Continue reading this post” message on the main page, and all the rest of the post’s text on the individual page. Cool, huh?
Two more things: in order for this to work correctly, you should make the “Continue reading…” message a hyperlink to the rest of the post. The only way I know of to do this in Blogger is to publish the post, then go back to “Edit Posts,” copy the post’s individual URL from the “View” link, then click the “Edit” link and go back in and add it. This is, admittedly, a bit pedantic, so if anyone has a better suggestion, please drop a comment onto this post.
Second thing, and this is HUGELY IMPORTANT: When you finish your post, make sure to put </span> at the end. If you don’t do that, then the rest of your main blog page will still be part of the “afterbreak” span, and will hence be invisible on the main blog page. Whammo! Just wiped out the entire blog in one post! (Actually, no – you’ve just hidden it. If you go back & put the </span> command at the end of your post, everything will return to normal).
So, there you have it. A somewhat convoluted, but totally workable way to put Post Breaks in Blogger posts.
Blog on, everyone…
Topics: Tech Talk | 3 Comments »


Re the closing SPAN tag: most blogs and CMS systems will autoclose an open tag to prevent exactly the kind of blogastrophe you mention. Perhaps that’s an option in your preferences?
Blogger is a web-based tool, not a publising tool like WordPress. As such, all it has to work with are embedded tags (some proprietary, some just basic HTML).
I accidentally forgot to close my first SPAN tag, which is how I know that happens. I could put in my template (so it goes at the end of every post), which would fix that problem, but may cause another problem down the road, so I figured I’d avoid that.
If someone wants to try that, though, it would certainly solve this, short-term problem…
FamilyGreenberg.Com is proudly powered by WordPress.
The template is from RFDN and has been modified extensively by yours truly
Here is the RSS feed for the Entries and here is the RSS feed for the Comments