Pencil Shavings

Wednesday, February 07, 2007

This is a test

Guess what I am testing?

The "Read more" code of course!

It's cool. It works.

There are two methods of creating expandable posts. 1. the "peekaboo" method, where the posts appear on main page after you click on the link; 2. the "post page" method, where pages appear on its own page after you click a link.

This is created using the "post page" method, as it is the same method I used in the old blogger.

Ramani of Hackosphere shows us how to do it in this post.


1. Find the

</head>

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


<script type='text/javascript'
src='http://www.anniyalogam.com/widgets/hackosphere.js' />



2. Find this div for the post-body and add the portion of code in red color.


<div class='post-body' expr:id='"post-" + data:post.id' >

<b:if cond='data:blog.pageType == "item"'>
<style>#fullpost{display:inline;}</style>
<p><data:post.body/></p>
<b:else/>
<style>#fullpost{display:none;}</style>

<p><data:post.body/></p>

<span id='showlink'>
<a expr:href='data:post.url'>Read More!</a>
</span>
<script type='text/javascript'>
checkFull("post-" + "<data:post.id/>");
</script>
</b:if>

<div style='clear: both;'/> <!-- clear for photos floats -->
</div>


To include the "Read more" link in your post, type <span id="fullpost">
at the point of the break, and </span> right at the end of your post.

I have to go back to all the old posts to change the code from "class" to "id". The costs of progress... :)

(Thank you Ramani for the code.)

3 comments:

beth said...

I think you're now experiencing the problem I had when I tried playing with expandable posts on Blogger...it's putting the "Read More" bit on every post - expandable or not. (Or so it looks from here.)

Hi, btw, I'm a regular lurker/never commenter. :)

Anonymous said...

Hi beth! Nice to meet you. I went back and redid the template and it solved the issue of the "read more" appearing on old posts. Maybe that will work for you?

(I'm obviously from the if-it-doesn't-work-turn-it-off-and-try -again school of thought) ;)

beth said...

Seems to be working well now! And so now I'll have to go read the directions because this is something I have long wanted to do myself. :)