0 How To Add Related Post To Blogger Post

Monday, March 7, 2011
Share

Do you like to post a related link post to your blogger on each post page of your blogger blog?. Then, The related Posts tips is for you. If you scroll down this my page you will see some links titled "Related Posts" But I rename it to be "People who read this post also read". This is a very useful Tips because it will enable visitors
to your blog read more articles on your blog, which might earn your more adsense clicks.

Well, there are loads of hacks out there but I will recommend this simple one have been using for a while now. This related posts hack is based on labels you labeled each post while blogging. To get the best out of this hack, don't use different labels all the time,select labels according to blog content.

With this tips, you can customize the number of related posts links to be displayed amongst other stuffs.This hack has been updated in November, 2009 and any blogger that do not update the hack to the latest version will not be seeing the related posts displayed on their blogs.

To Get Started

Just follow these steps:
1. Navigate to "Layout>>Edit HTML" from your dashboard. Make a back up of your template before you do any changes in the template.
2. Now, expand your template, that is, make sure that you have a tick mark in that "Expand Widget Template". Now, do a search using "CTRL+F" for the following line:

<data:post.body/>

3. And insert the following piece of code below just after the above line.

<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div class='similiar'>
<div class='widget-content'>
<h3>People who read this post also read :</h3>
<div id='data2007'/><br/><br/>
<script type='text/javascript'>
var homeUrl3 = &quot;<data:blog.homepageUrl/>&quot;;
var maxNumberOfPostsPerLabel = 4;
var maxNumberOfLabels = 10;
maxNumberOfPostsPerLabel = 100;
maxNumberOfLabels = 3;
function listEntries10(json) {
var ul = document.createElement(&#39;ul&#39;);
var maxPosts = (json.feed.entry.length &lt;= maxNumberOfPostsPerLabel) ?
json.feed.entry.length : maxNumberOfPostsPerLabel;
for (var i = 0; i &lt; maxPosts; i++) {
var entry = json.feed.entry[i];
var alturl;
for (var k = 0; k &lt; entry.link.length; k++) {
if (entry.link[k].rel == &#39;alternate&#39;) {
alturl = entry.link[k].href;
break;
}
}
var li = document.createElement(&#39;li&#39;);
var a = document.createElement(&#39;a&#39;);
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 &lt; json.feed.link.length; l++) {
if (json.feed.link[l].rel == &#39;alternate&#39;) {
var raw = json.feed.link[l].href;
var label = raw.substr(homeUrl3.length+13);
var k;
for (k=0; k&lt;20; k++) label = label.replace(&quot;%20&quot;, &quot; &quot;);
var txt = document.createTextNode(label);
var h = document.createElement(&#39;b&#39;);
h.appendChild(txt);
var div1 = document.createElement(&#39;div&#39;);
div1.appendChild(h);
div1.appendChild(ul);
document.getElementById(&#39;data2007&#39;).appendChild(div1);
}
}
}
function search10(query, label) {
var script = document.createElement(&#39;script&#39;);
script.setAttribute(&#39;src&#39;, query + &#39;feeds/posts/default/-/&#39;
+ label +
&#39;?alt=json-in-script&amp;callback=listEntries10&#39;);
script.setAttribute(&#39;type&#39;, &#39;text/javascript&#39;);
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 = &quot;<data:label.name/>&quot;;
var test = 0;
for (var i = 0; i &lt; labelArray.length; i++)
if (labelArray[i] == textLabel) test = 1;
if (test == 0) {
labelArray.push(textLabel);
var maxLabels = (labelArray.length &lt;= maxNumberOfLabels) ?
labelArray.length : maxNumberOfLabels;
if (numLabel &lt; maxLabels) {
search10(homeUrl3, textLabel);
numLabel++;
}
}
</b:loop>
</b:loop>
</script>
</div>
</div>
</b:if>

And you can put your own text to where I highlighted with GREEN color: Like "RELATED POST" or any phrase and sentence you like.

4. Now, Save your template.

Good Luck.... Cheer!!!

Feel Free to share this blog post with your friends using the share buttons on this page.

If you have anything to contribute or ask, Kindly make use of the comment form below.

In my future posts, I will share with your more tips about the ebook business and how you can be making money from ebook business even without writing any ebook.
So, for you not to miss the tips and be getting them right inside your email inbox even when you are not on the internet, kindly go to http://feedburner.google.com/fb/a/mailverify?uri=TheGeniusBlogger and enter your email. Once entered, you will have to check your email for a confirmation email containing a confirmation link. Once you VERIFY your email by clicking on the confirmation link in the message, YOU WILL NEVER MISS MY FUTURE ARTICLES AND FREEBIES AGAIN. Or click Subscribe to The Genius Blogger by Email

You can also read through these articles listed below it is very important:



0 comments:

Post a Comment

 

Copyright © 2011 Mixx Blogger Template - Blogger Templates by BloggerReflex

Sponsored by: Trucks | SUV | Cheap Concert Tickets