Seperti postingan saya sebelumnya yaitu Cara membuat Artikel Terkait di bawah postingan dan Cara membuat Artikel Terkait berisi Thumbnails, maka sekarang saya akan mencoba berbagi lagi :r dengan kawan cara membuat Artikel terkait yang keberadaannya di sidebar Blog.
OK langsung saja cara pembuatannya sebagai berikut :
- Masuk ke account Blogger dengan ID kawan
- Pada Dasbor - Rancangan pilih Edit HTML
- Simpan template kawan dulu untuk jaga-jaga
- Beri tanda centang disamping Expand Template Widget
- Copas (copy-paste) kode berikut dibawah ]]></b:skin> atau diatas kode </head>
<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 < 10) {
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>
while (i < relatedTitles.length && i < 10) { menunjukkan jumlah Artikel Terkait yang ditampilkan
Kemudian scroll kebawah dan cari Kode seperti berikut :
<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>
Hapus / ganti kode tersebut dengan kode dibawah :
<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>
<b:if cond='data:blog.pageType == "item"'>
<h4>Artikel Terkait</h4>
<script type="text/javascript">
removeRelatedDuplicates();
printRelatedLabels();
</script>
</b:if>
Catatan :
- Artikel Terkait adalah judulnya
- Silahkan ganti sesuai dengan selera kawan
- Save / simpan template kawan
Cara Pemasangan di Sidebar :
- Pada Dasbor atau tata letak Klik tambah Gadget
- Klik tanda tambah (+) pada HTML/JavaScript
- Copas (copy-paste) kode berikut kedalamnya
<script type="text/javascript">
removeRelatedDuplicates();
printRelatedLabels();
</script>
- Simpan Template
keren nihhhh
ReplyDelete@Zh!nTho apanya yang keren, saya kalah jauh dengan kawan apalagi otak sudah tumpul dan pelupa :z
ReplyDeletemau aku pake nih thanks share nya
ReplyDelete@Zh!nTho silahkan saja kawan :r
ReplyDeleteThanks for finally talking about > "Cara membuat Artikel Terkait di Sidebar" < Liked it!
ReplyDeleteAlso visit my blog: Montaż klimatyzacji
I'm not sure where you are getting your information, but great topic. I needs to spend some time learning more or understanding more. Thanks for wonderful information I was looking for this information for my mission.
ReplyDeleteHere is my site ... klimatyzacja
Very good article! We are linking to this great content on our site.
ReplyDeleteKeep up the good writing.
Check out my weblog: klimatyzacja
After I originally commented I seem to have clicked the
ReplyDelete-Notify me when new comments are added- checkbox
and from now on whenever a comment is added I get 4 emails
with the exact same comment. Perhaps there is a way you can remove me from that service?
Appreciate it!
Here is my page :: klimatyzacja
Fantastic items from you, man. I've be mindful your stuff prior to and you're just too excellent.
ReplyDeleteI actually like what you have obtained right here, really like what you're stating and the way wherein you are saying it. You're making it enjoyable
and you continue to care for to stay it wise. I can not wait to learn far more from you.
This is actually a terrific web site.
Take a look at my blog post klimatyzacja
I do not create a great deal of comments, but i did a few searching and wound up here
ReplyDelete"Cara membuat Artikel Terkait di Sidebar". And I do have 2 questions for you if you do not mind.
Is it simply me or does it give the impression like some of the comments look
like they are left by brain dead individuals? :-P And, if you are writing
on additional social sites, I'd like to follow everything new you have to post. Would you make a list of every one of your shared pages like your twitter feed, Facebook page or linkedin profile?
Check out my website: klimatyzacja
Superb, what a web site it is! This webpage presents valuable data to us, keep it
ReplyDeleteup.
Here is my web-site: klimatyzacja
Thanks for sharing your thoughts about klimatyzacja.
ReplyDeleteRegards