First of all download this file:
relatedPosts_ForBlogger2.js
Zipped File
And upload the file (relatedPosts_ForBlogger2.js) to MDN.fm or SigMirror.com to get a DIRECT LINK to that file.
1. Go to Blogger.com
2. Now go to "Layout", then to "Edit HTML" section
3. Back up your present template, by "Downloading it"
4. Now click on "Expand widget templates"
5. Find this code: </head>
Now, just before this code paste this
<!--RelatedPostsStarts-->Replace the link in RED with the DIRECT LINK, you got in the previous step.
<style>
#related-posts {
float : left;
width : 540px;
margin-top:20px;
margin-left : 5px;
margin-bottom:20px;
font : 11px Verdana;
margin-bottom:10px;
}
#related-posts .widget {
list-style-type : none;
margin : 5px 0 5px 0;
padding : 0;
}
#related-posts .widget h2, #related-posts h2 {
color : #940f04;
font-size : 20px;
font-weight : normal;
margin : 5px 7px 0;
padding : 0 0 5px;
}
#related-posts a {
color : #054474;
font-size : 11px;
text-decoration : none;
}
#related-posts a:hover {
color : #054474;
text-decoration : none;
}
#related-posts ul {
border : medium none;
margin : 10px;
padding : 0;
}
#related-posts ul li {
display : block;
background : url("http://www.gigaimage.com/images/brrl1rtaziisu0yj6kj6.gif") no-repeat 0 0;
margin : 0;
padding-top : 0;
padding-right : 0;
padding-bottom : 1px;
padding-left : 16px;
margin-bottom : 5px;
line-height : 2em;
border-bottom:1px dotted #cccccc;
}
</style>
<script src='http://sigmirror.com/............/relatedPosts_ForBlogger2.js' type='text/javascript'/><!--RelatedPostsStops-->
6. Now search for this code line:
<data:post.body/>And after this, paste these code lines
<!--RELATED-POSTS-STARTS--><b:if cond='data:blog.pageType == "item"'>To change the number of similar/related posts to be displayed, change the code max-results=xx
<div id='related-posts'>
<font face='Arial' size='3'><b>Related Posts: </b></font><font color='#FFFFFF'><b:loop values='data:post.labels' var='label'><data:label.name/><b:if cond='data:label.isLast != "true"'>,</b:if><b:if cond='data:blog.pageType == "item"'>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels&max-results=5"' type='text/javascript'/></b:if></b:loop> </font>
<script type='text/javascript'> removeRelatedDuplicates(); printRelatedLabels();
</script></div></b:if><!--RELATED-POSTS-STOPS-->
Finally save your template, and you will see related posts after all your posts(Remember to add labels after your posts, during publishing them)
Credits : Blogger accessories



























128 comments:
hey its not working. getting some error
Hello Sujith
thanks for the comment,
because of you an important correction has been made in the code, try it out now, it's working !
ya...now its working....thank u very much...
your site is very informative and helpful.
thank u very much
sujith bhakthan
Hi Divya, I found your blog and you got yourself a new subscriber, loads of interesting stuff!
Well, my problem is I implemented this script on my blog, and while its working fine its impossible for me to determine an exact number of realted posts to appear on the entries. With the default code I got about 12! Then experimented and for 1"e; id get no related posts in my last entry, 2 in my 2nd and 3 on my 3rd and so on! I finally settled on subsituting 5 for 2, what shows 6 or 7 an entry but id rather have a fixed amount of 3 related entries on every post. Can you help me work the code? Thank you!
btw, this is my blog, its in spanish but you get the idea todosobrecamisetas.blogspot.com
contact me at todosobrecamisetas@gmail.com
Hi Eleté
I have highlighted the code in RED color (in second code), which controls the number of posts to be displayed.
BUT, you have to write 1 number LESS than what you want in the code.
For ex. In my blog, I have used 7 in the code, and 8 posts are displayed as related posts.
So to display 3 posts, you have to replace the default 5 with 2, in the red code (max-results=5)
Hope this helps you !
And Thanks for subscribing, you are always welcome on this blog...
Regards
Sai
I REALLY want to get this to work in my blog, but it is not...I think it might have to do with my customized template. I don't get any errors...but nothing shows up on my blog. Can you help??? I would really appreciate any assistance you can offer.
Hello Jill
Download and send me your template, at bloggerstop.net[at]gmail[dot]com
I'll reply you where to add the code!
Regards
Sai
thanks bro it's really great.
http://www.dlcomplete.com
Welcome dude !
Hi , I googled for this trick and found your blog. Quite a high ranking! I liked it very much, loads of good stuff.
you seem to have hit a regular reader.
Anyhow I tried your code, it's not giving any error but neither it's showing up anything.
After reading the above comments I realized what I have to do. So I'm mailing you my template.
Hope to hear from you soon.
You can of course send me your template at the above mentioned email id !
your site is very informative and helpful.
thank u very much
Mansi
Thanks !
Searchles just came out with a contextual Related Posts widget for blogger that actually analyzes your text to match related posts - doesn't rely on categories or tags. Has SEO benefits too and is pretty easy to install. You just add a gadget to your layout and embed the code and it's up and running. It's pretty cool - you guys should check it out: http://searchles.com/misc/platform
Hi Divya,
This is a great resource. I have subscribed to this blog.
Good work.
thanks Amol....I admire regular & loyal readers, you are always welcome here !
I've tried it on my blog but it gives me an error.
can i send u my template too ?
thank you
good post,,i was looking for this for my web site
thanks
Welcome Henry !
Hi. Thank you for sharing this useful widget. I've tried to install it in my blog. But I find that it will only show the most recent 5 related post. Is it possible to make it to show random related post instead of the most recent one? Thanks
This code directly uses the feed link of your blog, so it shows the recent posts !
Thank you, it really works! :)
Wow, your site is truely great. Ignore the email I recently sent you--I managed to solve the problem I was having with this article.
Thank you
its not working for my blog too?what could be the issue
Hi I checked your blog, and found it working well, I hope you have solved the problem yourself, in case you have any doubts, feel free to ask here !
Regards
Sai
Hello! I am trying to add a "related posts" widget to my blog for days!
Your tutorial was the only that actually works for me!
Thank you!
And a question:
Is there a way to exclude the current post/article from the displayed "Related Articles"?
Thanks in advance!
Hi Loufadoros,
I am glad, that the tutorial was helpful to you, but I'm sorry there's no easy way to hide the same page being displayed...
Hi Divya,
Sounds Cliche,but the same s happening with me too.No errors but no results too!!
infact,i had encountered the same tweak somewhere else too and couldn get it working!!
Hi Divya.I have added the code and messed up the whole thing..Would u please agree to have a look if i send you the template..
Please give me ur email if possible so that i can mail u the template
Ok...you can send me at this id:
bloggerstop.net [at] gmail [dot] com
my related posts are not showing either man! I am emailing you the XML, kindly help me sort my problem.
Hi inAm,
I found the hack working perfectly fine in your blog, here's the screenshot:
http://www.gigaimage.com/images/0dsae29x14a5h98gan2m.png
I took the liberty of sending my XML template across to you. For some reason the code is not working although I have no errors. Please fix if you can.
Great blog!
Works Like Hell Man .. Finally Optimised my Blog To A great Extent using all the tips available on the web.. Watch it in action http://i-vasu.blogspot.com
Good work srinivas !
For those of you who aren't aware of this, once you implement the code it won't show up on your main page it will only show related links once you click on a post. I wasn't aware of this and send the template to Sai.
Sai helped me to change the link color from blue to white to fit my blogger template - thanks. To do this
change the #054474 in the first code to #FFFFFF. Works like magic - THANKS!
Thanks for revisiting and commenting "Owlman", I am glad to have visitors like you...you are always welcome here...
Regards
Sai
wow Great! its working on Mine.
Regards,
MOHD_
Hey Divya,
I hope u received my template..I had tried implementing the related post plugin and messed it up..Did u get time to have a look.
The name is OnlineTreasure
thx ! very big help God Bless ^_____^
Welcome Jahz !
When I add the code, there aren't any posts under the "recommended posts" banner. Yes, everything is labeled. Any suggestions.
Hi DaveL
I couldn't find my code in your blog, you are using some other code...
templates got crossed; when I first added the code, the related posts show, then after some post editing they all disappear.
Okay,
So now it's showing up again.....happy blogging !
yea.. works now. Great work on the code. Thanks for looking into it.
@ DaveL,
Presently in the code you are using this link(javascript file):
http://dsai.588.googlepages.com/relatedPosts_ForBlogger2.js
Plz download the zipped file from this post, and upload the file to your own account and the use the direct link in the code. Due to bandwidth problems, the widget may stop working many times a day !
o ok. thanks again for the followup
Welcome Dave
Hello,
Nice blog. I tried this widget on my blog http://shirdisaibababhajan.blogspot.com/ but m not able to see it. cn u please check wats the problem. Thanks in advance.
Sai Ki Deewani
Hetal Patil
Hello Hetal,
Do not worry, the widget is only not visible to you, may be you do not have javascript installed for your browser.....but your visitors will be able to see it, as the coding is perfect and it is visible to me too, screenshot:
http://www.gigaimage.com/images/6eqdln53chds75bheqm3.png
how to increase the size of the text link
In the first code, you'll see 11px at two places, change both of them to 12/13/14px (whatever size you want)....that's it !
Again thanks for your work; I can't seem to control the number of related posts. I set it at 6 yet more than that are populated, any help?
:D
Hi Divya,
Am back again with another question.
Is there a way to exclude the current post/article from the displayed "Related Articles"?
I'll try this out. thanks!
@ abra-ka-dabra
:-/
Nice post
Thanks i have implemented in my blog
http://tamilposters.blogspot.com
thanxxx too share code related links,,, now i put thses steps On my blog..... ha ha ha ha
& i gate more triffic from google
OR more time spand my visitors in my blog...
Ya visitors will definitely stay longer on blogs due to this trick...
Cheers !
Hi, I did exactly what you've said but the related post doesn't appear, could you please help me?
Thank you so much, it's working fine :)
thank is work..
I always hated the 'labels' widget I have. It cluttered the page. This is the coolest thing that ever happened to my blog!!
Step by Step tutorial.. thanks
:)
thanx
www.weeklyjobs.tk
It's good :)
Thanks for your share.
you are great,I badly needed this.Thanks a lot.Visit my blog at http://tashiwangdi.blogspot.com/ may you'll find something.Thumbs up!
Thnx for the tutorial
I have added and kept maxresults=4 but still it displays more than that random with different posts.
chk this How to Add Tweetmeme for Every post
its displaying 14 results.. and on other posts 6 some 8..
can u plzz rectify this problem..
i have fixed the problem and its not with max-results...
the results is controlled by other thing called i<20 make it 5 or 6 according to your needs..
its in script file and add the script directly to you file.. no need of external like this
<script type='text/javascript'>
Here the text file
>/script<
</script>
Thanks Vikas for mentioning that...
@Fusion
The problem is there where you have used more than 1 labels, and with increasing labels the count of related posts also inc. (with max results=20, as mentioned by Vikas above), so change that value in the .JS file and then either you can upload it or copy and paste the code in that file as shown by Vikas in the previous comment.
Hi Divya,
thnx for the quick reply...
The related post displays the post which we have opened... can u plzz tell me how to rectify that problem.?
Not to display the same post in related problem
Hi Divya Sai,
Waiting for your answer for the above post
"The related post displays the post which we have opened... can u plzz tell me how to rectify that problem.?
Not to display the same post in related posts"
We need to check the posts before display with post:data.title how?
Hi when add the widget it only shows up when once you have clicked on the individual blog and view it. Is there anyway of getting it to show up below the blog posts? Also it only show up when my blog is set to public not when its private. Is there anyway around this?
Thanks
Clayton
why is it that I cannot upload the .js file to sigmirror and hotlink, and other site like fileden for getting the direct link? pls help. thanks
ah nevermind, I've uploaded it to fileave.com and this widget worked! And that says so much coz this is the only widget for related posts that worked for me.
However, as asked also by Clayton in a previous comment, how is it possible to show the related posts in the front page,not when only clicking the post itself? thanks!
@ homeandonlinejobs
In the sixth point, simply remove these two bolded lines from the code:
<!--RELATED-POSTS-STARTS--><b:if cond='data:blog.pageType == "item"'>
<div id='related-posts'>
...
...
...
...
...
...
</script></div></b:if><!--RELATED-POSTS-STOPS-->
thank you so much, I've just subscribed through Google Reader. I love your posts ^_^
You-are-a-genious !!!
Man, this is just plain awesome !! But I see a little problem and is that the 'dotted' line is going to the 'Wideget zone' of my blog..
I think I can solve this with the Width/Height help, but if you know how to fix it surely, please answer me :D
Hello Danoxs,
I am glad you were here...
Yes, you have to change the width of the widget from 540px to either 500px or 495px, change the 5th line in the first code:
<!--RelatedPostsStarts-->
<style>
#related-posts {
float : left;
width : 540px;
margin-top:20px;
margin-left : 5px;
I have just seen your blog, and I liked the way you have used the opacity buttons on your blog, if you want I can show them as example work in that tutorial :)
Regards
Sai
Damn! You are a holy bless, dude !!
You are awesome ! How did you learnt all this ?
Oh, and I forgot, thanks for the tip and for the.. the.. how do you say it.. 'good words' or something like that XD
Hey Danoxs, I have just updated the tutorial with a link to your blog, as an example of creative work :)
your the best!!!
Hi Sai,
Let me tell you this,I've been on numerous website, and as for now, there is no other site like yours for people looking to dress up their blog. Thank you thank you.
Thanks buddy.....really glad to know that this blog helped you...please keep visiting
Just visited your blog too, and I must say that you have maintained it with with good & regular content and proper alignments & color combinations. One suggest I would like to give you is to take a custom domain too as your blog already looks pro, it just needs a domain.
thanks dude..........well am sorry dat i hav slightly changed ur script.......c urself
http://hack-krishna.blogspot.com
dnt feel bad 4 dat....i hav subscribd vth u.....
It's alright Krishna !
Very nice but is there any other site to upload the downloaded file.
Blogging Tips
Hello Salman,
HotLinkFiles.com is the best, other than this you can try sigmirror.com
Boxstr.com and fileden.com do not support hotlinking of .js (javascript) files
hi:
Is there a code like this for CLASSIC template users like myself who don't have the time to migrate to NEW and b/c I'm worried switching to newer templates will mess up what i already have.
check if you want at
http://indierockcafe.com
Hey Googe,
I haven't ever worked on Classic Templates....but I think this Pictorial Related Posts Widget will be helpful to you...
Thanks a lot I have added this it works gr8
http://free-books-world.blogspot.com
Thanks Divya sai...you are great...
Stumbled across your blog via google one day and I've been an addict since.
Well, I'm using schemer mag template and this hack ain't working on it. :(( Divya I really need your help on this one.
I started this particular blog last month and I learnt blogger ain't particularly good for SEO at the moment, I need all the help I can get to get some good ranking and I've been dying trying to make this widget work ~x(. Previously tried a couple of widget but it aint working too. PLEASE HELP ME OUT. I'LL E-MAIL YOU MY TEMPLATE.
Free Full Version Anonymizers, Anti-censorship &Online Privacy Tools | PC Tips and Tricks
@ doncaprio,
glad to know that you are addicted to this site :)
just visited your blog, but couldn't find the code. Anyways if you are sure that the there's wasn't any mistake in the code that you added then try the widget from linkwithin.com
feel free to comment here for any blogger help.
Thanks so much for dropping by. I really appreciate that you even cared to listen. I've tried linkwithin too on that template but didn't work...But guess what? I changed the schemer mag template to woodmag and everything worked perfectly. I've got linkwithin working on this great looking template. Thanks a million!
Free Full Version Anonymizers, Anti-censorship & Online Privacy Tools | PC Tips and Tricks
That's cool
Happy for you buddy!
Awesome! Thanks so much for the tip.
You are welcome buddy :)
Thanks..for the code..nice post
It doesn't show anything at my post at all. Could you please help me about it?
Hi Elizabeth,
Your widget is actually working perfectly, but it isn't able to to show any widget, cause you do not have more than 1 posts with a single label.
If "earrings" is a label you used in post-1, then you should add this same label to post-2...
And so, post-1 will be shown as a related post in post-2 and similarly post-2 will be shown under post-1 as a related post.
Ah, I see your point.. I'll go add more post and see what's the result. Thank you so much for your fast reply. I really appreciate it!
Hi,
I'm sorry I've to ask for your help again because nothing appeared even though I've another post with similar label.
Thanks for your kind attention
Well, your work till step #5 is all correct.
I can't chk your coding of step #6 in the blog. To chk it, send me your template via my contact page.
Hi Divya sai,
My question is .. will this setup show the related posts in the feed?
I want to show my posts in the feed.. so readers can click the link and.. it will increase the page views.
can you answer?
Giri
Well Giri,
Feed is limited to posts and comments, so widgets cannot be shown in it!
Name: Taimur Asghar
URL: http://psdmaterial.blogspot.com/
--------------------------------------
thanks worked :X
i dunno what wrong, my blog crash when use opera 9.64 after add this script. but i try to recheck one more. thank
sorry for my careless. but now succesful instaled on http://cuaryos.blogspot.com
Thanks buddy
Nice Post man
hai divya, amazing works, but it doesn't work for my blog, I don't know what went wrong.
I have red comments above one by one, and make it fix.
But It didn't work yet.
Please give me a hand to fix it... I really want to use related post widget...
Thanks
hello may i ask some questions....how to place the link within like this site which only visible in post not in home page...help asap... buzz me at my blog as u reply this..
www.khairulzamri.blogspot.com
Add that widget in a HTML widget (as you have already done). Then show it only below posts, using this tutorial:
http://bloggerstop.net/2008/12/show-widgets-in-only-specific-pages-or.html
Hope that helps.
I can't upload file on http://sigmirror.com
Hi there, instead of Sigmirror or Hotlinkfiles, upload the file to www.mdn.fm
Hi Sai
I am a big fan of you. Need your help on this one. Did this setting and got as expected. However, I would like it to be a little different.
1. I want the dotted lines to be a little shorter. Read one of the earlier comments to change the width to 495 or 500. However, on doing so, the sections below are getting mixed up with 'Related articles'.
2. Instead of the related articles coming in plain, i would like them to be put in some canvas kind with some light background. Is this possible?
3. For the time being, i have kept the "You might also like" section below. Its not very helpful since i cannot bring the widget before the share buttons. However, the "You might also like" automatically starts taking the default font of my blog.Is it possible in 'Related articles'.
My blog: http://unix-school.blogspot.com
Waiting for your input.
Guru.
Hey Guru, glad to know that...
1. According to your blog's width I think 500 is suffiecient, so no need to decrease the width, if it is causing some other probs.
2. Edit the starting few lines of code, which are:
#related-posts {
float : left;
to this:
#related-posts {
background: #F3EADA;
float : left;
You may use any other background color/image instead of that #F3EADA.
3. Couldn't get your third point.
Hello,
I love the above Tutorial, really helpful but could someone help me out.
How do you make the padding or margin from the left of the widget to go away or at least be way less?
Just in case you don't get what I'm saying, Here 's a screenshot: http://i29.tinypic.com/eiuvrp.jpg
Please Reply Soon. Thanks!
Make this one 0px,
margin-left : 5px;
so, it'll be become:
margin-left : 0px;
i have been searching for this kind of codes but nothing works.. i followed everythign in this tutorial but nothing seems to work... :(
Doesn't work for me, followed each step!
Allowed HTML tags: <b>, <i> and <a>
Join and share your views with other bloggers at BloggerStop Community
Comment Like This! and Optimize your blog...
SPAMMER OF THE MONTH: www[.]Seeking4Hosting[.]com