Welcome, visitor! [ Login | Sign Up ]

How To Add The Blogger “Read More” Expandable Posts Link



This is a pretty popular Blogger hack that lots of people have asked me about. Instead of answering to each email individually, I thought it would make more sense to write an article about it.

With this hack, you can choose to display a select amount of text from the beginning of each post as a teaser instead of showing the entire post on the front page of your blog. Then when people want to read the rest of the post, they can click a “read more” link to see the full post. This is very handy if you have lots of long articles all on one page. (Note that you’ll need to have post pages enabled in order to make this feature work.)

Step #1 – Update Your Template Code

First you need to edit your existing code so I recommend copying and pasting it into notepad or any text editor. Also, it’s smart at this point to create a backup of your template just in case something goes wrong. Now do a search (CTRL + F) within the text editor for the following code post-header-line-1. This is the default code that Blogger includes but some custom templates remove or change this code so you might have trouble finding it. If you can’t locate this text then try searching for <data:post.body/> instead. Your template will for sure have this since it’s the tag that actually prints the body of your post.

Now depending on which code you were able to find will determine how easy the next steps will be. You might need to do some detective work first in order to get this working properly in your custom template. The idea is to get this new code into your template before the <data:post.body/> tag. Keep reading and hopefully the explanation will illustrate the concept clear enough so you are able to adapt this hack to your custom template.

Add the following code below the <div class=’post-header-line-1’/> and <div class=’post-header-line’> tags if you’ve got both.

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

The result should look something like this:

new-code-block.png

If you don’t have the default <div class='post-header-line-1'/> tag then your result should look something like this instead. This is how it would be done in the MushBlue Blogger custom template:

new-code-block-mush.png

Notice in both examples that the code in yellow and the <data:post.body/> tags are the same — it’s just tag above it that will differ based on the template you’re using.

Now let’s add one more bit of code which will actually create the “read more” link in your post. This code will go below the <data:post.body/> tag so copy the following and paste it in. Feel free to change the “Read more…” text to whatever you want the link to look like. Be careful not to delete any other code during this process.

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

Yes, there are supposed to be two </b:if> tags in the above code so don’t think it’ s a mistake. The result should look like this:

new-code-block-2.png

This code will be the same no matter what template you are using. Just make sure it goes below the <data:post.body/> as shown in the image above.

Now let’s look at what the final result should be. Here’s the updated code block you just worked on all put together:

new-code-block-3.png

Ok, you’re all done editing the template code. Paste it back into your Blogger html window and save it. If you get an error, you made a mistake. The most common mistake is to accidentally delete a > or < while pasting in the new code. If it saved successfully, it’s time to move onto the next step and modify a quick Blogger format setting.

Step #2 – Add a Class Tag in Your Default Post Template

For this step, you need to navigate in your Blogger account to “Settings” => “Formatting” and scroll all the way down to the bottom. It’s the last option called “Post Template”. You’re going to paste in the following code:

<span class="fullpost">

</span>

You’ll want to keep the spaces in there which will make sense later. After you save this, it will look like this:

post-template2.png

Step #3 – Create a New Post

Ok, we’ve got everything all setup so it’s time to go and test it out. Hopefully you’ve got a new post in mind for your blog. If not, then we’ll just create a test post which you can later delete. When you click on the “Posting” tab, you’ll notice that the post text area is now pre-populated with the <span class=”fullpost”> and </span> tags. If not, then you didn’t save it properly so go back and re-read step #2.

So when writing your new post, anything you put above the <span class=”fullpost”> tag will be the teaser text. The main body of your post needs to go in between the <span class=”fullpost”> and </span> tags in order for the “read more…” link to work properly. See the screenshot below. Sometimes pictures illustrate better than words.

post-template-result2.png

Now publish or preview your post to see the “read more” hack working on your blog. If it doesn’t show up for some reason, go back and run through the steps again. Most likely you pasted the code blocks in the wrong places. It’s difficult to troubleshoot these issues since each template can be unique so please make sure to double-check your template before asking for help in the comments section below.

Here’s the live post with the “read more…” link properly working based on the text I used above in the post text area.

post-results.png

Additional Info

If you want to go back and update your old posts with this new “read more…” feature you can. Just go back and edit each post manually. Essentially you’ll need to paste in the <span class=”fullpost”> and </span> tags breaking apart the post into two parts.

For some posts, you might not want to use this feature at all. If that’s the case, just delete the <span class=”fullpost”> and </span> tags from within your new post text area. Then your new post will show up entirely just like it used to before you implemented this hack. Enjoy!

Ready to super charge your blog? Check out our professional premium blogger templates or make money by joining our blog affiliate program!

If you like this post then please consider subscribing to our eBlog Templates RSS feed. You can also subscribe by email and have new templates and articles sent directly to your inbox.




Trackbacks


578 Responses to “How To Add The Blogger “Read More” Expandable Posts Link”




   
Mansour on Feb 16, 2008, 3:48 am  

Thank you.
explain very beautiful.

๐Ÿ˜ฎ


   
Ashutosh Mishra on Feb 18, 2008, 10:11 am  

Thank you so much! I was looking for this since ages; hopefully this will speed up the loading of my blog.
๐Ÿ˜€


   
Ashutosh Mishra on Feb 18, 2008, 10:25 am  

I meant this:



.fullpost{display:inline;}


.fullpost{display:none;}


   
Ashutosh Mishra on Feb 18, 2008, 10:29 am  

Hey this is not working! Please look at this text:
http://ashuboss99.googlepages.com/Code.doc


   
Ashutosh Mishra on Feb 18, 2008, 10:45 am  

I worked it out….
sorry for the garbage comments ๐Ÿ˜ฅ


   
mirza on Feb 19, 2008, 6:14 am  

Thanx for the guide. Does it work with WP Premium Blogger template? I cannot seam to get it right anyone with the working hack on this template?


   
mirza on Feb 19, 2008, 7:14 am  

one more time ๐Ÿ™‚

For WP Premium Red Blogger template: the first code snippet should actually be pasted under:
div class=’post-header-line-1’/>
div class=’post-body entry-content’>

and not:
div class=’post-header-line-1’/>
div class=’post-body’>

It helped me, hope it helps othersโ€ฆ cheers!


   
Fernando Lopez Jr. on Feb 19, 2008, 2:00 pm  

Any working sample?

thank you.


   
mirza on Feb 19, 2008, 4:30 pm  

@Fernando: check out my blog. Check the code.


   
Fernando Lopez Jr. on Feb 20, 2008, 9:30 am  

doesn’t seem to work with internet explorer. i dont know if this is a blogger feature or a script mod problem.


   
Faizan on Feb 21, 2008, 11:07 pm  

Great hack and very nicely explained,David.
I have implemented it on my website,www.footyreview.blogspot.com .
Can you please tell us how to best integrate Intense Debate with our existing templates? Itried it on my test blog but had problems doing so.
Also, do give us more hacks and trcks you know of.
Finally, a very good website and some of your temltes are just superb.


   
David on Feb 23, 2008, 8:49 am  

@Faizan, thanks for your feedback and I’m glad you were able to add the “read more” link with ease. The Intense Debate add-on is a little more tricky so I’m glad you tested it on your test blog first. I’m not sure what else I can do to help you since the article I wrote is pretty clear (or so I thought). More tips and hacks are on their way. If you’ve got any recommendations, please let me know.


   
Danial on Feb 24, 2008, 3:15 am  

Hi ,
I Use Minyx Template From This Site , But I Search The Tag You Say , And Dont Find Any Thing .

Please Tell Me Where In Minyx Template I Can Add This Code .

Thanks .


   
Taylor Thompson on Feb 24, 2008, 4:32 pm  

๐Ÿ˜• DIDN’T WORK!!! Just made my posts not viewable… Redid 3 times and nothing…


   
David on Feb 25, 2008, 3:42 am  

@Danial, the data:post.body tag is actually on line 805 in the template code. Make sure you check the “Expand Widget Templates” box in the “Edit HTML” section of Blogger before you try and search for the tag.


   
Danial on Feb 25, 2008, 3:58 am  

WoW , Thanks , It Works , Thank You Very Much . ๐Ÿ˜ณ ๐Ÿ˜ฎ ๐Ÿ˜› ๐Ÿ˜ฏ


   
David on Feb 25, 2008, 4:06 am  

@Taylor, are you using a Classic Blogger template or the new xml Blogger? It only works with the new xml Blogger templates.


   
fiat2live on Mar 5, 2008, 4:30 am  

this method doesn’t work for older posts.can u tell me another hack work for the old posts โžก โžก


   
haju on Mar 12, 2008, 5:16 pm  

How can we use in out posts which are included span tag. ๐Ÿ™

Is it possible to change span tag with another tag.
It mixed up with other span tags ๐Ÿ™


   
Jake Tornado on Mar 13, 2008, 10:33 pm  

Dude, this doesn’t work for my blogger template Minima Black. I’ve tried it a dozen times that it wracked my brains.


   
aAkaR on Mar 18, 2008, 4:52 am  

thank you very much !!! ๐Ÿ˜‰


   
charles on Mar 18, 2008, 11:26 pm  

this is a great hack. thank you for sharing. ๐Ÿ™‚


   
Ilyas Kazi on Mar 19, 2008, 3:10 am  

Thanks for this nice hack…. ๐Ÿ˜›

I loved doing it here…
http://e-spice.blogspot.com


   
radith on Mar 20, 2008, 10:30 am  

can’t work at WP-polaroid template. Ca you explained what’s wrong with this template?


   
David on Mar 20, 2008, 11:48 pm  

radith, I’m not sure why it’s not working for you. Each template is different so I recommend trying to get it to work in a default blogger template first. Then you will know the ins and outs and can try it again in the polaroid template.


   
me on Mar 24, 2008, 6:59 am  

i want to thank mirza and not David for i almost mess my template


   
Frits on Mar 25, 2008, 3:58 pm  

I can’t get this working… When i use the

code the article just look like

lalala article lalala

lalala hidden article content.

i must doing something wrong with something so simple ๐Ÿ˜ณ ๐Ÿ˜ณ ๐Ÿ˜ณ


   
Frits on Mar 25, 2008, 4:08 pm  

Here the code doesn’t show up. At my blog you just see the code… ๐Ÿ˜•


   
Kate on Mar 26, 2008, 3:36 am  

This works for my new posts and instructions were easy to follow, but now i have “read more” on all my old posts and there is no on their html pages for me to delete. How can i amend the old posts? I went through the instructions again a few times but still get the same result.
Thanks.


   
David on Mar 26, 2008, 6:48 am  

Kate, did you go back to each old post and update them? It’s a painful process if you’ve got lots of posts. You’ll need to basically go through each post and break apart the text with the <span class=โ€fullpostโ€> tag. If you look at Step #3 again that’s basically what you need to do. Hope that makes sense.


   
Kate on Mar 26, 2008, 7:29 am  

Hi, i had tried this on three different posts and it is not working – any ideas? Could it be a placement issue? Thanks.


   
Kate on Mar 29, 2008, 12:52 am  

Hi David,
Unfortunately I could not make this work by simply adding the line of code to the old posts (not through lack of trying) so have decided to repost all old posts that require the split which works fine now.

With all old posts that do NOT require the Read More link at the end (i.e. short posts) I have been including this line of code at the end which seems to delete it – if anyone else want to do the same!
Thanks. ๐Ÿ™‚


   
Kate on Mar 29, 2008, 12:56 am  

Sorry here is the code again, didn’t show the first time.


   
OliMX on Apr 1, 2008, 10:17 am  

The posting was upfront and easy to follow. It worked out well for me, thanks a ton for this useful post.


   
Jason on Apr 2, 2008, 12:33 am  

Read me.. works fine. However, because the template has been update I get “read me..” at the end of every post regardless of whether the “fullpost” is present or not.

Is there a way of only having the “read me..” present where needed?

Thanks


   
Ade on Apr 4, 2008, 1:09 pm  

David:

So that the code would show, I’ve taken out the carrots here. But this (minus those carrots) is my code in the ad theme template. As you can see, it has the “post-header-line-1′” line but not the “post-hearder-line'” line. I tried to follow your instructions. But the code did not work. Perhaps I’m placing the code in the wrong place???

/span

div class=’post-header-line-1’/

p>

p class=’post-footer-line post-footer-line-3’/
/div


   
Ade on Apr 4, 2008, 1:38 pm  

Hey David:

I hope you don’t get tired of hearing from me. : )
For the Ad Theme template, I have found the code at the link below works out. If I’m out of line by providing this particular link, please feel free to delete my comment. : ) I just wanted to pass along what worked for this particular template.

http://hackosphere.blogspot.com/2006/11/selective-expandable-posts.html


   
ijajaja on Apr 6, 2008, 1:13 am  

This code seems to show the read more in every post although we don’t want.

If the pageType != item page then the Read more is displayed. I wonder whether there is a way to display only the ones we wanna show the Read more (the long post i mean).

Thanks


   
David on Apr 7, 2008, 6:00 am  

ijajaja, You’d have to go back and update all your old blogger posts if you want it to work for those. Otherwise just remove the <span class=โ€fullpostโ€> each time you type a new post and the “read more” link shouldn’t appear.


   
SuperSkyRockets on Apr 8, 2008, 12:50 am  

Hi there thank you so much I have been trying to do this for ages, yet another little piece of customisation for blogger!


   
Jeremy on Apr 8, 2008, 11:07 am  

Thanks for the great instructions. My only problem is I use formatting in my posts that there are several “” in the post. Can I still use this hack?


   
Jeremy on Apr 8, 2008, 11:09 am  

That should have been in the quotes in my above comment if I’d been thinking was /span.


   
David on Apr 9, 2008, 4:46 am  

Jeremy, yes you should still be able to use the hack. You should go through all your old posts and add the “span” tags if you want it to work across your entire blog. I’m not sure why you’re seeing double quotes though.


   
hnhuty on Apr 16, 2008, 5:09 am  

hello.. i have been using your adstheme blogger templates.. but cant implement the codes provided.. i’m getting the error that b:if tags must be ended with matching end tag.. but i did exactly what you have posted..

any help?


   
Jaxter on Apr 16, 2008, 3:38 pm  

this is very interesting!
i was need this long time ago

but important question
i am using windows live writer to publish my posts into my blogs

how it can works? :mrgreen:

please need quickly answer ๐Ÿ™„ ๐Ÿ™„


   
David on Apr 17, 2008, 9:14 am  

@Jaxter, not sure how it would work with Windows Live writer. Did you already try adding it to your Blogger template per the article?


   
David on Apr 17, 2008, 9:16 am  

@hnhuty, you must have deleted one of the tags by accident during the process (or left one out). Hopefully you have a backup and you can go back and try it again. Make sure to check the “expand widget templates” checkbox on the edit html page before trying to edit the template code.


   
Jaxter on Apr 17, 2008, 3:44 pm  

nope i will do your useful steps and tell you what happened ๐Ÿ™‚


   
Jaxter on Apr 17, 2008, 4:59 pm  

Wow it work very nice!! ๐Ÿ˜€

but just need to put

manually in Windows Live Writer.

thanks a lots

willing to see more impressive hack from this gorgeous blog :mrgreen: :mrgreen:


   
Jaxter on Apr 18, 2008, 5:21 pm  

i just wanted to add this hack to my other blog
but i always receive this message! ๐Ÿ˜

Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The element type "div" must be terminated by the matching end-tag "

what i should do? even if i want to add another such this things