In the last tutorial, we have seen how to add the Related Posts widget that would show related posts with thumbnails from the same category, based on the given labels, which would appear just at the end of your blog posts. However, maybe some of you would prefer the simple version of this related posts widget that will display only the posts titles.
If you want to add it, follow the next steps below:
Step 2. Press the CTRL + F keys and type the following tag inside the search box (hit Enter to find it):
To change the background color, replace the #f9f9f9 hex color in red (you can use this Color code generator to pick your favorite color). For the background color on mouseover, change the #F4F4F4 value in red.
Step 4. Now find (CTRL + F) this line below (there will be two lines like this, you should stop at the second one):
Step 6. Save the Template and visit your blog > click on any of your posts to see this simple related posts widget in action. Enjoy!
If you want to add it, follow the next steps below:
How to add Related Posts Widget to Blogger
Step 1. Go to Template > hit the 'Edit HTML' button and click anywhere inside the code area.Step 2. Press the CTRL + F keys and type the following tag inside the search box (hit Enter to find it):
</head>Step 3. Just above the </head> tag, paste the following style:
<b:if cond='data:blog.pageType == "item"'><style type='text/css'>
#related-posts {
margin: 15px 5px;
}
#related-posts h2 {
font-size: 27px;
font-weight: normal;
color: #fff;
text-shadow: 1px 0px 2px #888;
margin-bottom: 0.75em;
}
#related-posts a {
font-size: 13px;
color: #888;
text-transform: capitalize;
}
#related-posts a:hover {
text-decoration: none;
color: #555;
}
#related-posts ul {
list-style-type: none;
margin: 0 0 0px 0;
padding: 0px;
text-decoration: none;
color: #000000;
}
#related-posts ul {
list-style-type: none;
background: #f9f9f9;
border-left: 5px solid #f2f2f2;
}
#related-posts li {
padding: 10px;
line-height: 1.4;
border-bottom: 1px dotted #E2E2E2;
}
#related-posts li:hover {
background: #F4F4F4;
}
</style>
<script type='text/javascript'>
var relatedpoststitle="Related Posts";
</script>
<script src='http://helplogger.googlecode.com/svn/trunk/related_posts.js' type='text/javascript'/>
</b:if>
Customization:
To change the size (27px) and color (#fff) of 'Related Posts' title, change the values in red. For the related post link color, replace the #888 value in green.To change the background color, replace the #f9f9f9 hex color in red (you can use this Color code generator to pick your favorite color). For the background color on mouseover, change the #F4F4F4 value in red.
Step 4. Now find (CTRL + F) this line below (there will be two lines like this, you should stop at the second one):
<div class='post-footer'>Step 5. Just above it, paste the code below:
<b:if cond='data:blog.pageType == "item"'><div id='related-posts'> <b:loop values='data:post.labels' var='label'> <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=6"' type='text/javascript'/></b:if></b:loop>Note: To change the number of maximum related posts for each label, change the "5" parameter from max-results=5
<script type='text/javascript'> var maxresults=5; removeRelatedDuplicates(); printRelatedLabels("<data:post.url/>"); </script><a style="font-size: 9px; color: #CECECE; float: right;" href="http://bloggerchive.blogspot.com/2012/04/simple-related-posts-widget-for-blogger.html" >Simple Related Posts Widget</a></div></b:if>
Step 6. Save the Template and visit your blog > click on any of your posts to see this simple related posts widget in action. Enjoy!
Hi
I tried the code but it didn't work with me , plz help
www.umdeema.com
thanks
Hello,
Add the same labels to your related posts, otherwise it's not working. Or you can try adding the code from step 5 after <data:post.body/>
Good luck. And thanks for visiting!
Thanks a lot!!! :D
Wow...this was a great post. I have already implemented this code in my blog.
It worked for me! Thanks! Thanks and Thanks. Look at a glance- www.healthy24.net, simple but how nice!
Great job. Thanks for sharing.
nice share...
Thks
This is the shortest code I ever find for related post, thanks a lot for sharing this blogger SEO widget.
It doesn't work to my blog, I did what is your instructions but nothing happens. I have the same labels. linkwthin works but not yours.. please help!.
Yeah Thanks... This is Work.. But Related Post With Thumbnail doesn't Work in my blog... Link Within doesn't Work too... Only This That Work in my blog, if you have a spare times, please tell me Why? :) ... THank You Very Much :)
Thanks its working nice.But the title "Related posts" is not showing up
mantap... very nice blog... a have doing it..
Try to add the code from step 5 just after <data:post.body/> and see if it works. Sorry for the very belated answer..
Thank gan.
working excellentely thanks a lot.
I was looking for such an easy tutorial from a long time your one is really very good.
Hi, I don't have either of the Step 4 lines in my template html - is there another line I can look for? Thank you!!
working excellentely thanks a lot.
Doesn't work for me at all. Tried both setups would you be able to help me out? Thanks!
Hmmm.. NIce it's really simple.
Hi,İ did it but did not appear as I wanted,could you pls help me
Dosent find the code div class='post-footer'
works cool great tutorial for related post works perfectly
Nice, though I'm trying to figure out on which labels it's based on. Thanks! allsignlanguage.blogspot.com
Perfect..just perfect...worked for me ...thank you.
Hmmm...it doesn't work.
And there're 3 places in the Template scripts that contain .
Cheers
http://ramblerwithoutborders.blogspot.com
how can i know what code is blue color
sorry,it doesn't work for me....
I've been looking for this and tried to implement but it didn't work for me. I dunno why.
thanks, this widget is very good and simple
It does work for my webpage :(
thanks very much, this is the best for me
great work dude, this is the best a simple related posts :D
Yess its work for me
It works perfect, Man! Great work!
I'm just wondering if there's a way to avoid that the post itself appears in the "related posts" list.
Thanks its work in my blog
thanks gan, mantap!
Many thanks, it worked on my blog.
I dont Know why but Not Working..
Thanks for the great widget! In my theme I have two [div class='post-footer'] so I had to put code from step 5 after the second one in order to make it work. However I found one significant issue: it prints a link to the current post (itself) as related post.
To remove the post itself from related list just replace data:post.url with data:post.canonicalUrl in code from step 5. Easy!
Excellent post !!
thank but, but i dont see Related Posts tittle, how can i fix?
bro, it doesn't work.
hopefully you can update this and if it can be used in blog post or static page, that would be... awesome....