We started as a free blogspot blog 6 months ago,
Now we make $500 per month. Want to learn from our experience? read and subscribe!

Related Posts on Blogger. And they said only Wordpress has it?

By Jacky Supit • Sep 1st, 2007 • Category: blogger hacks

Have Our Post Delivered to Your Inbox!

Enter your email address:

This is a Related Posts step-by-step Manual Instructions. Before applying this blogger hacks (may i call it a blogger hack? : ) I recommend you to create a dummy / test blog, so everything will still be under control if you are having trouble with it.

Note: If you have problem on installing this trick, please scroll down and read the update below. you can also the demo here. so if you have problem copying this code, you may download that template and copy the code inside it. thanks

update: to make you easier, you can download the related posts / articles on .txt file here.

Actually Related Article by Label has already created by Hoctro, and i must admit that he had done a really great job. that’s why I didn’t create this hack widget (oh I will mention it as Widget from now) from scratch. I use his widget and modifying it as a better and fit to my need.

First, you may want to read the original article on hoctro blogs here. There are couple thing I don’t like from the original widget. there are;

1. On Previous version, It uses 2 blog’s widget. Now I cut the code, so we can put it anywhere on the same blog widget. Why I don’t like to use 2 different widgets? Because your code would be too long, and you can not have your Related Post List right under your post area and Above the comment section. It is because it uses 2 different widgets.

Sure you can use 2 widgets and place the Related Posts Lists under post area and above the comment section, but that would make your code so not tidy. you with me?

2. On previous version, Users have to modify the code them self so they can use it. They have to fill a Parameter with their Blog Url. Now they need no more! I have modified the code so users will be able to use it just as simply as copy and paste.

3. On Previous Version, and this is important. The Current Article / Post will also be listed inside the Related Post/ Article Lists. that is not right isn’t? Related Posts / Articles means Other Articles / Posts which have relation with the current Article. Not the current Article it self.

I believe Hoctro knows all that points I mentioned above. And I’m sure it is easy for him to update and upgrade the code. It just i don’t know how to contact him, because he hide his comment section on his site. So..

Hope he will permit me to do this, I will modify the code by my self for your use. So here it is.

*Again, if you want to have the old version, you can go to that hoctro’s link above.

and here it is,

Step by step to install the
RELATED POST WIDGET FOR BLOGGER / BLOGSPOT

1. GO to your Template Editor, Under your blogger / blogspot Dashboard.
Click on the DOwnload Full Template Link. save your downloaded template as a back up, just to prevent in case you failed on applying this hack.

Then, tick the Expand Widget Templates.

2. Find this code below

<data:post.body/>

3. Copy this code below

update: to make you easier, you can download the related posts / articles on .txt file here.

<div class='clear-block;'/><b:if cond='data:blog.pageType == "item"'>

<div class="similiar">

<!-- *****************http://hoctro.blogspot.com*****Jan,2007****************** -->
<!-- *****************Related Articles by Labels - Take Two****************** –>

<!–

Modified by JackBook.Com to make it easier to use.

1. Now, users don’t need to change anything to use this widget. just copy and paste, and done!

2. The current article will also be listed, now it’s no more.

–>

<div class=’widget-content’>

<h3>Related Posts by Categories</h3>

<div id=’data2007′/><br/><br/>

<div id=’hoctro’>

Widget by <u><a href=’http://hoctro.blogspot.com’>Hoctro</a></u> | <u><a href=’http://www.jackbook.com/’ title=’Related Posts on Blogger Modified by JackBook.Com. Read More?’>Jack Book</a>

</u></div>

<script type=”text/javascript”>

var homeUrl3 = “<data:blog.homepageUrl/>”;

var maxNumberOfPostsPerLabel = 4;

var maxNumberOfLabels = 10;

<b:if cond=’data:blog.pageType == “item”‘>

maxNumberOfPostsPerLabel = 100;

</b:if>

<b:if cond=’data:blog.pageType == “item”‘>

maxNumberOfLabels = 3;

</b:if>

function listEntries10(json) {

var ul = document.createElement(’ul’);

var maxPosts = (json.feed.entry.length <= maxNumberOfPostsPerLabel) ?

json.feed.entry.length : maxNumberOfPostsPerLabel;

for (var i = 0; i < maxPosts; i++) {

var entry = json.feed.entry[i];

var alturl;

for (var k = 0; k < entry.link.length; k++) {

if (entry.link[k].rel == ‘alternate’) {

alturl = entry.link[k].href;

break;

}

}

var li = document.createElement(’li’);

var a = document.createElement(’a');

a.href = alturl;

if(a.href!=location.href) {

var txt = document.createTextNode(entry.title.$t);

a.appendChild(txt);

li.appendChild(a);

ul.appendChild(li);

}

}

for (var l = 0; l < json.feed.link.length; l++) {

if (json.feed.link[l].rel == ‘alternate’) {

var raw = json.feed.link[l].href;

var label = raw.substr(homeUrl3.length+13);

var k;

for (k=0; k<20; k++) label = label.replace(”%20″, ” “);

var txt = document.createTextNode(label);

var h = document.createElement(’b');

h.appendChild(txt);

var div1 = document.createElement(’div’);

div1.appendChild(h);

div1.appendChild(ul);

document.getElementById(’data2007′).appendChild(div1);

}

}

}

function search10(query, label) {

var script = document.createElement(’script’);

script.setAttribute(’src’, query + ‘feeds/posts/default/-/’

+ label +

‘?alt=json-in-script&callback=listEntries10′);

script.setAttribute(’type’, ‘text/javascript’);

document.documentElement.firstChild.appendChild(script);

}

var labelArray = new Array();

var numLabel = 0;

<b:loop values=’data:posts‘ var=’post’>

<b:loop values=’data:post.labels’ var=’label’>

textLabel = “<data:label.name/>”;

var test = 0;

for (var i = 0; i < labelArray.length; i++)

if (labelArray[i] == textLabel) test = 1;

if (test == 0) {

labelArray.push(textLabel);

var maxLabels = (labelArray.length <= maxNumberOfLabels) ?

labelArray.length : maxNumberOfLabels;

if (numLabel < maxLabels) {

search10(homeUrl3, textLabel);

numLabel++;

}

}

</b:loop>

</b:loop>

</script>

</div>

</div>

</b:if>

3. Paste right after the code #2 (<data:post.body/>)
Please be flexible. You can do experiment by put the <data:post.body/> inside a <p></p> tag like this.

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

4. Save your template. refresh your blog, and Done.

That’s all. Enjoy!

Note; Related Posts is a list of all posts related to some article based on the labels. And because this uses Javascript, if you want to create a list of posts related by content, it might be pretty hard to do currently.

Updates | Important Note :

For some people who always failed and/or getting error on installing this related posts trick. Kirk Warren from weeklycrisis.com has founded the solution for you. here is his comment

The reason you are getting the errors is because whatever he did with the formatting in this script boxes has ” and ‘ wrong. If you look at them in the Blogger template when you paste the code, they come off as ’ (notice it is slanted to the left, not straight down like a normal single quote [ ‘ vs ’ ]. Same thing happens with the ” and “. Notice how one is straight down and the other is to the right [” vs “]. This is what is causing all the hassles for people.

Most likely, when he recovered the post from Google cache, it had reformated the quotation marks on him and this is why you get that error. Manually replace all the ‘ and ” in that section of code and you should be fine.

update: to make you easier, you can download the related posts / articles on .txt file here.

Thanks

Don't forget to subscribe!

Related Entries

About the post author:

Jacky Supit is The man behind the site. Do you have any questions, problems or anything about your blogger or wordpress? AskJack on TemplateForum.Org

82 Comments »

Comment by Jack
2007-10-01 13:41:05

Sorry for all deleted comments. I have accidentally deleted this post. I restored this post from google cache.

Comment by sensibleguy
2008-01-02 16:12:56

well how could that happen?? dont you make backups?? wordpress allows users to make backups righy??

 
 
2007-10-01 13:46:02

[…] The Related Posts has already been embedded. if you want to remove it, please read about this widget (on the link […]

 
Comment by Amanda
2007-10-01 21:03:10

Thank you so much for this hack! I have been trying for days now to implement this, and your version is the only one so far which has worked for me :)

Just one thing though: when I tried to copy and paste the code into my template, I kept getting error messages about that “–” was not allowed in the comments, ot that the XML was not properly formed. The way I eventually used this was by copying the code from one of your other blogger templates instead.

However, I am just so happy that I managed to finally install this script! Many many thanks :))

Comment by Jack
2007-10-05 20:04:20

Hi Amanda,
many people put the code on the wrong place. please make sure that you paste all the code rite after the <data:post.body/>

 
 
Comment by romica
2007-10-02 04:20:37

Thank you!

 
Comment by hoctro
2007-10-04 16:21:47

I’ll look into this for sure,

Thanks for giving your comments. I n so busy I turn off comments.

 
Comment by phyzhoe
2007-10-05 02:17:44

help me! i cannot add this thing. This is my blog http//michealsoft.blogspot.com

Comment by Jack
2007-10-05 20:03:05

have you followed all the instructions carefully?
what is the error message you got?

Comment by ShirtsonSale
2007-10-08 12:48:56

It seems like there may be an issue with the quotation marks in the posted code (maybe as a result of recovering the post?). Tried figuring it out, but wasn’t able to.

(Comments wont nest below this level)
 
 
 
Comment by TonNet
2007-10-06 02:58:38

Sorry to bother you but it actually looks kool. However I don’t know why I am receiving this message after trying to save the template: 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 string “–” is not permitted within comments.

Any input?

 
Comment by domox
2007-10-11 05:41:39

i have this error

error de XML: The string “–” is not permitted within comments.

coudl somebody tell me what is???

2008-01-26 12:12:42

so many script i :oops: dont understand

 
 
Comment by Kirk Warren
2007-10-15 03:20:04

The reason you are getting the errors is because whatever he did with the formatting in this script boxes has ” and ‘ wrong. If you look at them in the Blogger template when you paste the code, they come off as ’ (notice it is slanted to the left, not straight down like a normal single quote [ ‘ vs ’ ]. Same thing happens with the ” and “. Notice how one is straight down and the other is to the right [” vs “]. This is what is causing all the hassles for people.

Most likely, when he recovered the post from Google cache, it had reformated the quotation marks on him and this is why you get that error. Manually replace all the ‘ and ” in that section of code and you should be fine.

Comment by Jack
2007-10-18 13:29:29

Thanks for your finding Kirk. I will put your answer as an update on my post. thanks

 
 
Comment by Kevin
2007-10-20 23:19:38

Wow….
I just thought…googled…and got….

thanks for this hack…

 
 
Comment by Filthyfun
2007-11-02 19:39:43

Your related posts version finally works for me (THANKS!) but I have a problem with labels that have countryspecific characters in it (I am german). So the letters ä,ö,ü and ß are converted in the Hack. Example: The word Fundstücke shows up as Fundst%C3%BCcke. I could of course change the labels - no problem at all. But if there’s a way to display them correct in german that would make the hack even more useful.

There’s another small visuell issue: If you give your post a label for the first time the hack can of course not show any related post to it but it still displays the new label. Is there a way to avoid that?

Comment by Jack
2007-11-03 13:01:47

Oh that is a good finding.
thanks Filthyfun, I’ll try to figure it out.

thanks

 
Comment by Cihan
2007-12-13 15:38:59

Just replace:

var txt = document.createTextNode(label);

with

var txt = document.createTextNode(decodeURI(label));

Enjoy!

 
 
Comment by Half Doctor
2007-11-08 17:04:20

Hey nice Job!
I’m using this widget!!
Few suggestions for improvement…
1. Why don’t you increase the space between the Main Post and “Related Posts by Categories” line

2.Most importantly why don’t you include something so we can limit number of related posts appearing say to 2,5,10

Thanx in advance…

Comment by Jack
2007-11-09 14:00:25

oh that’s cool.
let’s try that later, thanks

 
 
Comment by Half Doctor
2007-11-28 01:24:31

Hey it’s in the code! I modified my code a bit, to get the tweaks I needed! Update version on my website!

 
Comment by chrischam
2007-11-28 12:59:06

Okie, i got this thing worked.. but i changed few things..

like “”.. its not working for me
so, i changed it to ”.. now its working! :lol:

Comment by chrischam
2007-11-28 13:50:59

instead of “ ”
i use ‘ ‘

on “”

 
 
Comment by vladbuk
2007-12-07 23:40:10

Thanks. Very useful addition. But there is one problem. The Widget distorts the coding non Latin names of labels. I unfortunately could not understand in Java code. There can be you will prompt as to remove output of the name of a label under an inscription “Related Posts by Categories”?

 
Trackback by Anonymous
2007-12-22 23:31:55

Cunt Nice…

 
Trackback by Anonymous
2007-12-22 23:32:48

Woman A To Seduce How…

 
Trackback by Anonymous
2007-12-22 23:33:41

Naked Rebecca Loos…

 
2007-12-23 07:52:27

[…] is a Related Posts step-by-step Manual Instructions. Before applying this blogger hacks (may i call it a blogger hack? : ) I recommend you to create a dummy / test blog, so […]

 
Comment by julia aquino
2007-12-26 05:04:30

i will try this one!

 
Comment by julia aquino
2007-12-26 05:05:38

wow! i added it already it so easy!

(eeew! you have some spam comments!)

Comment by Jacky Supit
2007-12-26 09:32:22

thanks Julia, yea, i hate those spam :( seems my askimet doesn’t work correctly these days

 
 
Comment by Lis
2007-12-29 18:45:12

Thanks for the great hack. I’ve successfully installed this on my blogs. :smile:

 
Trackback by Anonymous
2008-01-01 11:55:03

rachel poen starr star…

rachel poen starr star…

 
Comment by vietnamrss dot com
2008-01-01 22:25:37

Thanks you very much:) This post is full help with me -> Unicode Support for me -> Thanks Cihan

 
 
Comment by tim
2008-01-04 17:04:45

i have no this string
Using your templates. what to do?
p.s. world-area-codes.blogspot.com

Comment by Jacky Supit
2008-01-05 09:51:32

hi Tim,
sorry, but what were you trying to say?
i’m afraid, i don’t get it :) thanks

 
 
Comment by The Kacrut
2008-01-16 17:08:58

thanks you so much bro jackbook, Good Luck..!!

 
Comment by Space of Reality
2008-01-19 15:08:30

Hi Jack. I followed your instructions… however it is getting related posts based on category. Is there anyway I can make that as Related Posts based on the title. Also, the Related post only appear when you visit each page. Is there any way to make it on the first page?

Thanks :D

HYe

Comment by Jacky Supit
2008-01-20 13:03:49

Hi SoR
Of course the related posts list appears on the post page. if it is appear on the front page, then which those links related to? relate to the homepage?
sorry, but currently, i have only the related posts by category.
thanks

 
 
Comment by OiaCeive
2008-01-23 22:25:52

Hi Jack,

IE show this ERROR my blog oiaceive.blogspot.com

entry has no properties
[Break on this error] var posttitle = entry.title.$t;

Can you help to resolve it?

Tanks

 
Comment by Rottenrocks
2008-01-24 13:20:54

not works on me but demo site was good.

 
2008-01-26 12:08:16

I found nothing to replace.hoe bout that?

 
Comment by pete
2008-01-30 05:12:53

just set this up. thanks!

 
Comment by Richard Rinyai
2008-02-02 01:48:37

Hi,

I installed the code as it was instructed here, but it’s still not showing up on my blog (www.theprorfessionalassistant.net).

Please help.

Thanks,

Richard Rinyai
http://www.theprofessionalassistant.net

 
Comment by TopSeo Blog
2008-02-11 21:33:49

I guess the code has some problem. i have to copy from other template :twisted:

 
Comment by technologyrules
2008-02-15 15:33:22

Its really useful Jack…

 
Comment by Faizan
2008-02-17 16:41:09

Hey jack,this is a great hack and its working fine for me.
I have one question for you, how can we limit the number of related posts per label or overall,its showing too much related posts.
thanks

 
Comment by sachinKT
2008-02-23 01:09:59

Work for me when i use txt link code i paste this code above

thanks !! :smile:

 
Comment by sachinKT
2008-02-23 01:11:08

includable id=’commentDeleteIcon’ var=’comment

above this code

 
Comment by Ellias McMunny
2008-02-25 01:46:28

hi.. i followed this tutorial link from my friend abibakar (http://abibakar.blogspot.com)

really nice..

i’ve planted it on my blog. Thank you jack!

 
Comment by Xue
2008-03-01 16:51:15

“Why don’t you increase the space between the Main Post and “Related Posts by Categories” line”

I would also like to have more space between main post and this widget. Is there anything I could do to fix this?

“I have a problem with labels that have countryspecific characters in it (I am german). So the letters ä,ö,ü and ß are converted in the Hack. Example: The word Fundstücke shows up as Fundst%C3%BCcke. I could of course change the labels - no problem at all. But if there’s a way to display them correct in german that would make the hack even more useful.”

I have this same problem with my Finnish blog. And I really need to use ä and ö. Hope there would be same way to correct this.

 
Comment by Online Guide
2008-03-06 09:14:12

Is there any other way of doing the related post… i mean instead of related post by category, it could be related post by keyword or something. Thanks.

Comment by Rome
2008-03-31 04:50:41

Yeah, it would be also be nice if it was like this.

 
 
Comment by phyzhoe
2008-03-06 20:26:34

thanks Jack.. lastly i manage to insert this on my blog.. problem occur because of the quotation thing.. many2 thanks.. my blog is rocking awsome now!. i think this is the simplest way to add related posts into blogger. :smile:

 
Comment by Mohammed
2008-03-11 06:01:31

Hi, how do you get rid of the label showing above the related posts, like you have on your site.

Thanks.

 
Comment by AdieStudio
2008-03-11 10:30:29

still not made it jack :( :oops:

 
Comment by Female Seven
2008-03-11 11:07:48

Female seven is great for man :) :roll:

 
Comment by JaneAir
2008-03-20 20:11:41

Amazing, wonderful, marvelous !!! :mrgreen:

(I suppose there’s no way to decrease the size of the text “Related posts from categories”)

Thanks for this hack, jack ! :grin:

 
Comment by tambenk
2008-03-22 04:15:23

mas punya saya udah tak install dan sukses.
tapi kok ga muncul ya?

trus saya mo nambahin related post-nya gmn?

thx

 
Comment by David
2008-03-22 12:54:12

Jack,

Thanks for this hack. I have two questions:
1. When I create a post with a brand new label, the back shows that label as heading even though there are no other posts in it. Can I hide that heading?

2. Is it possible to hide all the label headings and just have the posts listed?

Thanks,

Dave

 
Comment by budzer
2008-03-28 09:42:35

Hi Jack, thanks for this hack.
I’ve installed it for quite a while.

Just want to share one thing. We can also add adsense code inside this hack.

Thanks again.

 
Comment by Ana
2008-03-30 19:26:02

Hi Jack. I love your script, really well done. But before getting it back to my blog I also would like to get rid of the label headlines and to just have the post listed instead. Could you tell us what to change in the code please?

 
Comment by 123
2008-04-05 12:47:21

This script belong to : http://hoctro.blogspot.com
please write source of this post

 
Comment by danz
2008-04-07 05:14:54

Sigh…I’ve been doing this all evening and it’s not working. The widget isn’t showing up on the page at all. I didn’t get any error messages so I don’t understand what the problem is.

 
2008-04-14 22:20:38

[…] Read more and install related posts for your Blogger blog (Jackbook version) […]

 
Comment by Blogger
2008-04-15 02:33:39

Thanks jack, but where should i paste it if i want it after all comments?

 
Comment by Rob O.
2008-04-15 02:41:24

Please pardon me if this seems a silly question, but is this hack specific to “New” Blogger or will it also work on my Classic Blogger-based blog?

 
2008-04-25 16:12:48

[…] Related Content Every page of your website should be interlinked to related content. Include a sub-heading that identifies related articles and include links to other content that might interest your readers.Don’t have it yet? You can learn about how to put related content on your blogspot blog here. […]

 
Comment by justin
2008-05-02 04:17:37

Hi Jackbook
i keep getting the following error:
Your template is invalid because the tag ‘b:section’ appears inside of the tag ‘head’.

any ideas on how to fix this? can this hack be added to this particular template? thanks so much for your help

 
Comment by Dette
2008-05-04 05:38:54

OMG.

I just installed this hack and it worked… perfectly!

Thank you SO much for making this super easy - I am still in shock of how simple it was - lol.

You ROCK! :D

 
Comment by Vikas
2008-05-04 20:06:35

Jacky,

Thanks for the help that I got from this post. Only a couple of problems I have now.

One is that is there anyway, these related posts can come below the post on the first page also or can they only show on the post page. Your comment of Jan 2008 says it can be there only on the post page. Any change now?

Secondly, anyway these related posts can come below the footer?

Vikas.

 
Comment by sahith
2008-05-08 03:05:37

Thanks

 
Comment by laragosta
2008-05-08 21:10:14

hi, i put your hack on my blog and that’s the error: Element type “b:if” must be followed by either attribute specifications, “>” or “/>”. any help? my blog: http://scappadallastanzablogspot.com

 
Comment by deane
2008-05-12 00:41:11

thanks for this hacks..:D

 
Comment by encikmayon
2008-05-12 06:42:54

hi,
i dont know if i should ask this, but i’m new to blogging. my blog already have nearly 400post and i dont label any post. the code detect post label. i cant imagine to label all the post all over again. can the code detect related post by post title?
please help. thanks.

 
Comment by Amit
2008-05-14 22:48:51

Hello Jack

I tried to add the related posts in my blog but could not help it.Every time i am getting the error message.I have also tried replacing all that” and ‘ but still the same.Please provide an updated code.

Many of us need it badly

thanks
Amit
http://techthek.blogspot.com

Comment by Jacky Supit
2008-05-16 13:49:11

hi Amit, blogger have changed their system, i guess i have to modify the codes first. please be patient. thanks

 
 
Comment by kiidogo
2008-05-16 03:12:18

@muhammed: “Hi, how do you get rid of the label showing above the related posts, like you have on your site”

I’m trying to do this same thing… Jack can you please tell us how you get it the way YOU have it on your blog? Without the label showing above the related posts?

 
Comment by Andrea
2008-05-16 21:18:03

Hi jack. I would like to delete the name of the label that appear before the related links. What i have to change in the code?Thanks!

 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> in your comment.