This Is A Sample Of Sticky Post


The Problem is: to do this trick, we must use HTML code to make up the text... But don't worry, if you are not capable with HTML Codes, there are simple and fast way to make your sticky post without learn it. Use your "New Post" to make a sample of your sticky post, set the display as close as your real post, use the Preview to check your sticky post display then copy-paste into your content collumn text add gadget.

Learn how to make this sticky post in http://doit2us.blogspot.com/2010/02/how-to-make-sticky-post-in-your-blogger.html

Blogger Related Post I- The Naked Script

>> Tuesday, March 16, 2010

Actually I had long enough to discuss about how to make a related posts widgets in blogger because of it's very useful function.

 According to the name - related post - this widget provides information to visitors who are reading our articles that there are other articles that discuss the similar or related topic that maybe they will be interested with. The main goal is to make our guess visiting times become longer, this means making our blogs become more populair and for those who put some ad on their site / blog, it will give more chance that the ad will get attention from the visitors.

After a long search from internet about how to make it, I found quite a lot of tutorial on "blogger related posts". Almost all of them use external JavaScript, some working and some did not. Most of Not Working related posts widget because of it's server and the other because of it's wrong Script, it seems to be a little miss code when posting the article. ( please read How To Posting Source Code in Blogger Post / Articles ).

Both long and/or short script related post widget that we find in the "blogger related post widget"  Tutor, actually consist of two major parts. JavaScript Codes that serves to showing related post itself, and HTML / CSS Codes that used to set the display of related post.

In this article I will not discuss about setting the display of related post widget, because we can find a lot of ways out there even displaying the related post with it's screenshot link.

As I ever mention in How To Make Recent Comment II. The use of external JavaScript (File JS stored on outside server) can speed up our web pages loading times. The problem is we often can not see directly the contents of those Java Script, because the server restrictions or by the owners file setting. This will lead us to fear of the presence of malicious script inside those "invisible" JavaScript.

So in accordance with the title Blogger Related Post - The Naked Script, I will give a Related Post JavaScript -Naked-  So you do not feel worry anymore cause you can see it's contents.

//<![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>');
document.write('<a rel="dofollow" href="http://doit2us.blogspot.com">Learn How To Make This Related Posts Widget [?]</a></font>');
}
//]]>
We can simply created Related Post Widget by putting this JS directly inside our HTML template codes...

Go to your Dashboard >> Layout >> Edit HTML and check Expand Widget Templates.
Find this codes
]]></b:skin>  
</head> 
and Put this simple display setting Script between it,
<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 { font-size : 20px; font-weight : normal; margin : 5px 7px 0; padding : 0 0 5px; } #related-posts a { text-decoration : none; } #related-posts a:hover { text-decoration : none; } #related-posts ul { border : medium none; margin : 10px; padding : 0; } #related-posts ul li { display : block; background : url(&quot;http://1.bp.blogspot.com/_cNpXRtRph18/SpbSRYurg2I/AAAAAAAAD7Q/GbYNm2feyIQ/rss.png&quot;) no-repeat 0 0; margin : 0; padding-top : 0; padding-right : 0; padding-bottom : 1px; padding-left : 21px; margin-bottom : 5px; line-height : 2em; border-bottom:1px dotted #cccccc; } </style>
Next put the JavaScript right after (below) it. So the final Script will look like :
]]></b:skin> 
The Display Setting Script
Related Post JavaScript
</head>
Next search for <data:'post.body/>. In some templates this code may look like: 

<div class='post-body>
Add this folowing script just below  <data:'post.body/>
<b:if cond='data:blog.pageType == "item"'>
<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 != &quot;true&quot;'>,</b:if><b:if cond='data:blog.pageType == &quot;item&quot;'>
<script expr:src='&quot;/feeds/posts/default/-/&quot;   data:label.name   &quot;?alt=json-in-script&amp;callback=related_results_labels&amp;max-results=5&quot;' type='text/javascript'/></b:if></b:loop> </font>
<script type='text/javascript'> removeRelatedDuplicates(); printRelatedLabels();
</script>
</div></b:if>
After finished all, Save Your Template and click View Blog.. there you go.. You have new related post widget in your blog.

Note :
  • To make this related post widget works.. then you must have more than one article with the same label/tag/catagories. 
  • This related post widget not work in your main page (home).

We will discuss more about this related post widget setting in the next artikel.

26 comments:

Ricky March 18, 2010 7:11 AM  

Thanks for this.
Its a great help for webmasters!

http://www.highprofitpoint.com

Maya April 20, 2010 6:31 AM  

I know a better way to show related posts in blogger.com blog. Though thanks for share this tips.

çizgi film izle May 17, 2010 10:45 AM  

Hi there, I found your blog via Google while searching for first aid for a heart attack and your post looks very interesting for me.

MP3 November 9, 2010 7:24 AM  

how to display related posts link in source code? currently it only appear if we point the link on browser but in the source code it shows /feeds/post/default only.. is there a way?

Data Center Monitoring November 25, 2010 10:31 PM  

Really you have post very nice post on java script good sound.

search engine optimization melbourne November 26, 2010 10:05 PM  

Amazing script you have shared with us. it is better among my visited article. thank you for sharing.

Arcuz January 1, 2011 6:51 AM  

Is there a method on trying to use other feeds such as the feedburner instead of the default feeds of blogger?

school software May 3, 2011 7:32 PM  

hanks for publishing relating to this. There?s a mass of important tech data on the web. A person?ve got lots of that data here on your site. I?michael amazed ? I try to keep a few weblogs fairly on-going, however it?utes a struggle occasionally. A person?ve carried out a great job with this one. How can you get it done?

Phone Sex May 22, 2011 9:05 PM  

I appreciate it very much, at least I know from it someone is reading the contents I have here.

SEO Southampton May 24, 2011 3:35 AM  

we can find a lot of ways out there even displaying the related post with it's screenshot link.

Seo Company jaipur May 26, 2011 8:31 AM  

if we point the link on browser but in the source code it shows /feeds/post/default only.. is there a way.

web hosting jaipur August 2, 2011 2:32 AM  

Wow It is nice info. Great helpful for me. thanks a lot!

accident claims company August 9, 2011 10:21 PM  

Both long or short script related post widget that we find in the "blogger related post widget". This article helps me a lot of the things that I want to know. It provides information that is really applicable in some other terms.

whiplash claim August 24, 2011 11:11 PM  

I am please to find this opportunity to read a worth reading information. Thanks and keep it up..

what is an iva October 3, 2011 10:38 PM  

Knowing this info. is really worth it.

whiplash compensation October 20, 2011 10:07 PM  

I am glad to see that your blog share valued information that can help to many readers.

adil October 29, 2011 11:08 AM  

i have done every thing what you said exactly... template saved well, no errors. . but still i can't see the related posts in my blog posts.. i am very worried please help me how to fix it.. i shall be very very very thankful. i have tried with other scripts to from other websites but same problem . . template saves well but nothing appears in my posts. please help
my blog is
http://adilclinic.blogspot.com

skin tag removal home remedy November 11, 2011 12:26 AM  

I was desperately looking for such relevant and nice blog and you blog looks nice enough to deserve the nice information for all. I will definitely come back for more cool postings...

facial mole removal November 22, 2011 2:03 AM  

That was a really good article, thanks for taking the time to put it together! You have managed to point out some very good points. I can't say that I completely agree about some points, but you certainly have a unique perspective. Anyway, I like your post.

Anonymous,  December 19, 2011 4:35 PM  

I never had visited a rare blog like this. I am very glad to read an interesting article with lots of knowledge shared by the blogger. I will be looking forward to this blog for my future reference. Thanks for posting.

Interface Network

debt management companies December 20, 2011 9:12 PM  

Its a pretty useful information. Thanks:)

Anonymous,  January 13, 2012 12:45 AM  

I’ve been traveling to your site for some time today and i also always locate a treasure with your brand new content. Appreciate your expressing!

best 42 inch tv 2011

Anonymous,  February 1, 2012 4:00 PM  

Pretty good post! I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon.

car battery reviews

Anonymous,  February 1, 2012 4:02 PM  

All the posts are fully informative and having very good themes. I love to visit your blog again and again it’s really increase my knowledge. Thanks for the awesome post.

car battery reviews

Anonymous,  February 2, 2012 7:20 PM  

I have gone through the article and found interesting information helped me in getting the best answer that I am looking for.


schwinn recumbent exercise bike

Post a Comment

 

  © New Blogger Tips For Us Free Blogger Template by Mc 2010.

Back to TOP