Wednesday, September 9, 2009

How to create expandable post and “Read More” links

As your blog becomes more popular and you add more nice and long posts, older ones are starting to shift more to the bottom of the page where it is hard to notice. Here is a little hack which would help to fix this problem.

It is not complicated and does not require more computer skills then creating a blog.
This code is designed for the, however can be used for any other blog site.

I recommend using free version of CoffeCup HTML Editor. But you can atchive the same result without this tool.
It’s smart at this point to create a backup of your template just in case something goes wrong.

Step 1:
  • Log in to your account and click on Dashboard

  • Click on Layout link

  • Click on Edit HTML

  • Check “Expand Widget Templates” check box

  • Now you need to find <HEAD> tag, to do that press CTRL+F and enter this tag there and click SEARCH or FIND.

  • Add and new line right after this tag and enter this code

     <b:if cond='data:blog.pageType == "item"'>
        span.fullpost {display:inline;}
        span.fullpost {display:none;}

    like this:

Step 2:
  • Search for <data:post.body/> tag the same way as in step 1.

  • Add a new line after this tag

  • and copy and paste this code

    <b:if cond='data:blog.pageType != "item"'><br />
     <a expr:href='data:post.url'>Read more!</a>

Step 3:

The final piece that we need is a little bit of code in your actual post. Each post that you want to use this feature on will need this code:

No comments:

Post a Comment