Fixing Read More link appear on Blogger Fullpost

Thanks to Paul Escolar who really use my code on 'How to create expandable post summaries in Blogger' and spot a bug on that tutorial.

Hence my code for this blog is already changed for other additional stuff. Sorry for that silly mistakes . As I went to debug my tutorial, I found that whoever follow that tutorial properly will get the same result as Paul's blog. So, here is the explanation and how to fix it.

Please check at the last chunk of code on 'Step #1 - Edit your template code'. The old code should look like this:


<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == &quot;more&quot;'>
<a expr:href='data:post.url'>...<b>Read more</b></a>
</b:if>
</b:loop>
</b:if>



where the previous screenshot is this:



What this code do is checking the 'more' label and put that 'Read More' link at the end of your post, regardless you are in fullpost or not. So, to wipe it out when we are in fullpost, you just have to add this two lines of code, before and after that code chunk:


<b:if cond='data:blog.pageType != &quot;item&quot;'>
<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == &quot;more&quot;'>
<a expr:href='data:post.url'>...<b>Read more</b></a>
</b:if>
</b:loop>
</b:if>

</b:if>



In blogger layout code, the fullpost page type is called 'item'. So, this 'if statement' is added to check that we are not in 'item' post and only do loop through the labels and add the Read More links then.

That's it, you may save your template now and see the difference. Good Luck!!





Comments

Frugal Wench said…
Hi. Just found this technique, but I don't understand one thing. How do you ad the "read more" to the end of the teaser? Sorry, I'm not a coder, so I'm not very good at this. Can you please give me a picture of how to do this and make it link to the rest of the post? Thank You!
ApOgEE said…
hi frugal wench, you should read the first tutorial as I have explained in detail there. click here to read the first tutorial
Anonymous said…
beautiful man... perfect work...

do you have any tutorial in your blog on how to create a related article list between the post and comments?

I will put you in my favourites ;)

nice work man...
brett.peace said…
THANK YOU! Seriously, the two tutorials you did on expandable posts are hands down better than any other explanation on the web. As you pointed out, even Blogger's *own* help section leaves it to us, the consumer, to figure it out--as an "exercise"! Incredible! They should update the help section and link to your blog instead!
ApOgEE said…
Alexandre, thanks...
I don't have that tutorial yet. Hopefully, I have to create one for you.

brett.peace, thank you!
Anonymous said…
Hi. I found this technique and it worked great. I just have one problem with it, is it possible to do it without having the the word more in label. I would hate to have the label more appear on the sidebar when it has nothing to do with the content of the post itself.
ApOgEE said…
Scooter, yes you can change the 'more' label to other label you like. But make sure that you don't use that label on your non-expandable posts. Also make sure that you change the code to check for the 'more' label with your new label name.
Anonymous said…
Thanks for responding but I guess i wasn't clear in my question. I have no problem with the word "more". My problem lies with the word more appearing under the label section in the sidebar. Is there anyway to keep this from happening?
Hungry Gal said…
Hi ApOgEE

I must be a luddite... I have read & re-read your instructions including the update. And I am still having difficulties finding the "p> data:post.body/ tag... I found the data:post.body but there was no "p" in front of it.. what am I missing? thanks (sorry I couldn't use the <> part
Hungry Gal said…
ApOgEE

Never mind! I kept fiddling with it and it appears to work. Wow. thanks!
Admin said…
Help! I followed exactly what you said but the words "Read more" won't display. The only difference I see is that there is no "< p >" or "< /p >" in the original code. Did I put the code in the correct place?

data:post.body/

(your code)

clear for photos floats
/div
Anonymous said…
Nice work, coder!
Tried it out, and it works fine.

One thing that momentarily threw me was the "more" label. You just add it to the "Labels for this post" input box on the "Create" or "Edit Posts" tab when you create or edit a post.

Very simple, and you covered it perfectly in you tutorial, but I was lost in CSS, thinking I had to add it in the html. Mais, non! I only reiterate it here in case others flake out similarly.

Bravo! Thanks.
-- Jim
(http://www.cyclopsvue.blogspot.com)
Admin said…
Ohhh... duh! But it still doesn't work. :( It's still not displaying "Read more" for me. Argh!

Is there a way of doing a "Read more" without using labels? I've seen it done elsewhere: http://www.ageofautism.com
Cyberaz123 said…
Good job man... This was exactly what I wanted... worked perfectly...
THANK YOU VERY MUCH !!
Raw Patrick said…
This is really brilliant. Thanks a lot!
jtmcdc said…
Dude. Seriously.

I had been struggling with this all day, trying all different sites and running into the same brick walls. Then I came a cross your tutorial. By far the most clearly explained and exampled posting I've found. Almost worked first time, and was disheartend to view my blog, only to realize my failure yet again. I read your directions again and saw that i had missed to the step about adding the 'more' tag.

So now, accomplished and satisfied, I thank you, for I am going to sleep deeply contented tonight.

Youv'e got yourself another subscriber:)
Learning to Fly said…
Yeah, I'm having the same trouble as PS and the other poster. My code is sans the p and /p. Is this why the rest of my text in the main body area is not showing up on the post?
Worm said…
Top work!

I'd struggled to find the solution to this myself, but using labels just didn't occur to me. Well done!

Followed.
minivan said…
Hi!

at first I would like to thank for the code. I used it and had the same issue with the "Read more" still showing up in the full post. Here I can see I could make it disappear. But do you think it is possible to have a link "Back to blog" instead? It would be a really nice feature. If it'd cause you too much work just forget it, I'll follow this instruction.
Jud said…
Ok, I've tried about a dozen websites looking into this hack. This is the only one I got to work. Great tutorial, you're a genius.
Peter said…
this doesn't work for me. i don't have a < data : post . body / > tag anywhere within my html template. (i had to add the spaces because it wouldn't let me enter the tag normally)
any suggestions?
this code is an amazing effort, but not working for me. I placed both codes properly 1. before 2. after . But no read more etc is coming on the front page. Plzz sort it out. i am using sun rays template www.support.org.in
ApOgEE said…
Hi Support for Mother Earth, did u follow the first tutorial properly?
If not, please check it out at How to create expandable post summaries in Blogger.

If you have done that, make sure you add 'more' tag on those post you want the 'Read More' link to appear.

Popular posts from this blog

How to Create Hyperlink on Blogger Post

How to Add a Sudo User on AlmaLinux 9.2 (Turquoise Kodkod): A Step-by-Step Guide

How to Check AlmaLinux Version on the Command Line: A Quick Guide