CAUTION

While the Guest Book at the The-Raden is still not there, please leave a footprint in every post. Thank You ..

Related Article on The Blogger Sidebar

Been on a blog friend in the afternoon, I found the article "how to make the articles linked in the sidebar?". I was curious and wanted to try it!

Login to your blog -> Design -> Add a Gadget -> HTML/JavaScript -> Titled "Related Articles"
contents with the following code:
<script type="text/javascript">
removeRelatedDuplicates();
printRelatedLabels();
</script>


Edit html -> Expand widget templates
Look for the code </head> (use Ctrl + F to search)
Replace the code </head> with the code below :
<!-- Related Post -->
<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>
</head>

Next look for the code:
<div class='post-footer-line post-footer-line-1'>
<div class='post-footer-line post-footer-line-2'>
<div class='post-footer-line post-footer-line-3'>
Select one, then paste the following code just below the code above :

<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<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=15&quot;' type='text/javascript'/>
</b:if>
</b:loop>
</b:if>


Edit HTML -> Expand widget templates
Look for the code title = 'Related Articles'
Similar to the code below :
<b:widget id='HTML2' locked='false' title='Related Articles' type='HTML'>
<b:includable id='main'>
  <!-- only display title if it's non-empty -->
  <b:if cond='data:title != &quot;&quot;'>
    <h2 class='title'>$3B<data:title/></h2>
  </b:if>
  <div class='widget-content'>
    <data:content/>
  </div>
  <b:include name='quickedit'/>
</b:includable>
</b:widget>

Now, you add the red code
<b:widget id='HTML2' locked='false' title='Artikel Terkait' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
  <!-- only display title if it's non-empty -->
  <b:if cond='data:title != &quot;&quot;'>
    <h2 class='title'><data:title/></h2>
  </b:if>
  <div class='widget-content'>
    <data:content/>
  </div>
  <b:include name='quickedit'/>
</b:if>
</b:includable>
</b:widget>

Code that is green in disregard it, because it's the serial number of widgets.
Code blue is the number of "Related Articles" that appear

How to make the article linked in the sidebar is pretty complicated? however, this method is already in practice before. if any question please you (readers) to Comment! Thank You.

Free subscription to the article via RSS FEED

Immediate confirmation of your email so that I could send you the latest software for free to your email!

7 comments:

arie5758 said...

thanks for the tips..
an thanks to you for visited my blog :)

Andi Aulia Febrianti said...

visited :D

Melia Propolis sang penyembuh ajaib said...

unfortunatelly man, I can't give even single comments as hot as chillies, and peper as I am a soft person...bener ngk nih bahasa inggris ku he..he..he..

Rezky said...

good tips, thx for share :)

virgo said...

You can also try linkwithin widget to get other articles posted in every post you make. It is also easy to install the widget.

j O C y said...

happy visiting here..

mikexplorer said...

visiting here with happiness in my heart.. Keep in touch my friend..

Post a Comment

Follow This Blog

Tesssssssssssssssssssssssssssssssssssssssssssssssssss