A relatively easy method of increasing page views on your blog is to add a list of related posts below each article. This offers readers a ready-made reading list of other articles on your blog, which are of a similar theme or subject matter.
For those using Blogger to publish their blogs, there are a few different methods available to display a list of related posts. These “related posts hacks” return a list of recent articles from the label(s) assigned to the particular article.
In this post, I’ll offer an overview of five different related posts hacks for Blogger blogs, which will offer your readers a taste of other related articles from your site.
Related posts by Categories - List in Sidebar
Hoctro was among the first Blogger hackers to devise a method of displaying related posts.
In this tutorial, you can learn how to add a related posts widget to your sidebar which offers relevant further reading for each individual post in your blog.
Related Posts by Categories - List Beneath Post
Jackbook’s Blogger hack is similar in structure to Hoctro’s tutorial as it lists related posts according to their relevant category. However, this version will display links beneath each post rather than in the sidebar.
This seems to be the most popular related posts hack for Blogger, and is relatively easy to add to your Blogger template in just a few steps.
Related Posts Widget - Beneath Posts
Purple Moggy developed a related posts hack which displays links in one longer list, rather than being segregated into different categories.
This widget will display beneath the main Blog Posts widget (beneath your comments) and is configured to display only on item pages.
Related Posts Plugin for Blogger - Beneath Article

RealTrix has developed a “plugin” style hack for Blogger which displays related articles in a stylized list.
This hack can be added to your Blogger template in only two steps, and references an externally hosted JavaScript to parse and display labels from your blog feeds.
Related Posts With No External JavaScript
After scrutinizing Purple Moggy’s method, I devised a technique to display the simplified list of related articles beneath the post without the need for external JavaScript files. This method enables you to display a simple list beneath each post (before the comments section) which should be styled in the same manner as other lists in your posts.
Here is how you can add this simple function to your Blogger template:
1. Go to Layout>Edit HTML in your Blogger dashboard, and check the “Expand widget templates” box.
2. Paste the following section of code just before the closing </head> tag:
<script type=”text/javascript”>
//<![CDATA[
var relatedTitles = new Array();
var relatedTitlesNum = 0;
var relatedUrls = new Array();
function related_results_labels(json) {
for (var i = 0; i < json.feed.entry.length; i++) {
var entry = json.feed.entry[i];
relatedTitles[relatedTitlesNum] = entry.title.$t;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == ‘alternate’) {
relatedUrls[relatedTitlesNum] = entry.link[k].href;
relatedTitlesNum++;
break;
}
}
}
}
function removeRelatedDuplicates() {
var tmp = new Array(0);
var tmp2 = new Array(0);
for(var i = 0; i < relatedUrls.length; i++) {
if(!contains(tmp, relatedUrls[i])) {
tmp.length += 1;
tmp[tmp.length - 1] = relatedUrls[i];
tmp2.length += 1;
tmp2[tmp2.length - 1] = relatedTitles[i];
}
}
relatedTitles = tmp2;
relatedUrls = tmp;
}
function contains(a, e) {
for(var j = 0; j < a.length; j++) if (a[j]==e) return true;
return false;
}
function printRelatedLabels() {
var r = Math.floor((relatedTitles.length - 1) * Math.random());
var i = 0;
document.write(’<ul>’);
while (i < relatedTitles.length && i < 20) {
document.write(’<li><a href=”‘ + relatedUrls[r] + ‘”>’ + relatedTitles[r] + ‘</a></li>’);
if (r < relatedTitles.length - 1) {
r++;
} else {
r = 0;
}
i++;
}
document.write(’</ul>’);
}
//]]>
</script>
3. Next, find this section of code in your template:
<b:if cond=’data:post.labels’>
<data:postLabelsLabel/>
<b:loop values=’data:post.labels’ var=’label’>
<a expr:href=’data:label.url’ rel=’tag’><data:label.name/></a><b:if cond=’data:label.isLast != “true”‘>,</b:if>
</b:loop>
</b:if>
This is usually located in the “post-footer” section of your template (in the Blog1 widget), though if you have customized your template the location may be different.
Replace this entire section of code with the following instead:
<b:if cond=’data:post.labels’>
<data:postLabelsLabel/>
<b:loop values=’data:post.labels’ var=’label’>
<a expr:href=’data:label.url’ rel=’tag’><data:label.name/></a><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=10″‘ type=’text/javascript’/>
</b:if>
</b:loop>
</b:if>
This adds the JavaScript required to parse labels from your blog feed.
4. Finally, find this line in your template:
Immediately after this line, paste the following section of code:
<b:if cond=’data:blog.pageType == “item”‘>
<script type=”text/javascript”>
removeRelatedDuplicates();
printRelatedLabels();
</script>
</b:if>
Then save your template.
Now when you view a post on it’s individual page, you will see a simple list of related posts appear just before the comments section. This list will be styled according to other list elements in your posts, and automatically adjusts to complement the style of your template.
I hope this post has offered some useful links and methods of displaying a list for further reading in your Blogger powered blog. If you know of any other methods, please let us know by leaving your comments below.













HairySwede | September 8th, 2008 at 12:58 pm #
maybe a dumb question. but how do these techniques determine which posts are related? title keywords? keywords within the post? tags?
Tinu | September 8th, 2008 at 3:44 pm #
Hairy - it varies depending on the method and plug-in. Some go by tags, some go by the title. On one of my blogs, I can tell from the results that it’s going by category.
My preference for related posts is beneath the article. Only problem with that is that in some themes it’s also the best place to put subscribe info. This article gives food for thought though.
Ganesh | September 9th, 2008 at 9:08 pm #
I guess Javascript on your own server does nothing to slow down the page. Whereas javascript on some other server does slow down the page. Thanks.
Mohamed Rias | September 16th, 2008 at 10:55 am #
Hi Amanda ,
i have written a post on this topic ” Related Posts Widget - Bugs Fixed” . Actually Realtrix admin copied my Code , you can see that in CSS code it includes my name mohamedrias.
please look at that and make a note of my post.
regards,
Blogger Accessories
Nabeeha | September 23rd, 2008 at 12:26 pm #
which line are you talking about….
Finally, find this line in your template
I think you havent parsed the html thats why its not displaying…. please check…
Nabeeha | September 23rd, 2008 at 12:32 pm #
oh its very sad that just becuase only one line is not displaying the … icould not save the whole tmplate….
Herit Shah | September 24th, 2008 at 6:15 am #
I have figured out the exact missing lines. You can surely apply this method, dont need to worry.
Herit Shah | September 24th, 2008 at 6:15 am #
,
Herit Shah | September 24th, 2008 at 6:18 am #
sorry, i did mistake two times, here is the exact lines after which you have to paste the code.
,
Rapidshare | October 5th, 2008 at 5:42 am #
Haha, i’m liking this blog more and more..
I had been looking for a related posts mod for a few of my own blogs for a while
thanks again
mohammed qasim | October 15th, 2008 at 1:40 am #
Hi Amanda,
Which line are u talking abt?????
pls specify the line after which we have to paste the last html code.
waiting for ur reply
qasim
Mitz | October 20th, 2008 at 8:34 am #
Hi Amanda,
There’s no line shown on step no.4
Susan | December 12th, 2008 at 8:39 am #
I’ve been trying to add this to my blogger blog but I get this error message:
“Your template could not be parsed as it is not well-formed. Please make sure that all XML elements are closed properly.
XML error message: Open quote is expected for attribute “{1}” associated with an element type “type”.”
Any suggestions as to what the problem is?
Thanks.
Static | December 30th, 2008 at 12:36 am #
Line 4 is not showing up in your posts or comments.
I’m assuming this is a crucial step to make the hack work.