Langsung ke konten utama

Cara Memasang Related Post pada Blog

Artikel yang berkaitan atau related post merupakan sebuah cara untuk menampilkan link-link artikel yang berkaitan dengan artikel utama yang diposting.

Pemasangan fiture ini biasanya dikelompokkan berdasarkan label atau kategori. Jadi jika ada salah satu artikel dari label tertentu ditampilkan maka artikel-artikel lain yang mempunyai label sama juga akan ikut muncul dibawah artikel tersebut.

Tujuan pemasangan artikel yang berkaitan ini agar pengunjung mudah untuk membaca artikel yang berkaitan dengan artikel utama. Sehingga pengunjung tidak perlu repot lagi untuk mencari satu persatu artikel dalam menu label atau kategori.

Cara Memasang Related Post pada Blog 

Cara Memasang Related Post:

1. Pada dashboard Blogger. Pilih menu Template -> Edit HTML

2. Klik pada kotak Edit HTML dan cari (CTRL+F) kode:
<data:post.body/>
    Pilih kode yang ke-2 atau yang paling Akhir (biasa terjadi bila Anda pernah meng-edit HTML template)

3. Jika sudah ketemu, letakkan kode berikut ini dibawah <data:post.body/>
<b:if cond='data:blog.pageType == "item"'>
<div class='similiar'>
<div class='widget-content'>
<h3>Baca juga artikel yang lain :</h3>
<div id='data2007'/><br/><br/>
<script type='text/javascript'>
var homeUrl3 = &quot;<data:blog.homepageUrl/>&quot;;
var maxNumberOfPostsPerLabel = 4;
var maxNumberOfLabels = 10;
maxNumberOfPostsPerLabel = 10;
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>
Catatan : 
*Baca juga artikel yang lain : dapat Anda ganti sesuai keinginan Anda
*10: Jumlah posting yang akan tampil

Selamat mencoba.

Komentar

Postingan populer dari blog ini

Juggernaut - Relic Blade of the Kuur-Ishiminari

This is mod sword of Juggernaut - Relic Blade of the Kuur-Ishiminari Dota 2 Reborn common weapon. This item originally from Lost Treasure of the Ivory Isles (Series 3). Green beautiful ambient effect will shown when idle and especially if Yurnero using his 1st skill "blade fury". Mod type: Standart . Hope you guys like this mod and support our favorite game in steam community market. The essence of gaming is fun. No money? Just mods. Enjoy the game and boost your MMR! For installation mod guide: How to install mods with vpk creator . Juggernaut - Relic Blade of the Kuur-Ishiminari

Terrorblade - Foulfell Corruptor

Terrorblade - Foulfell Corruptor mod mythical item Dota 2 Reborn from Treasure of the Emerald Revival with ultra rare chance to get it. This set has ambient effect on the weapon, Blades of the Foulfell Corruptor. This set items consists of: Armor of the Foulfell Corruptor, Demon Form of the, Foulfell Corruptor, Blades of the Foulfell Corruptor, Wings of the Foulfell Corruptora and Helm of the Foulfell Corruptor. It can be combine with  Terrorblade - Fractal Horns of Inner Abysm arcana mod. Hope you guys like this mod and support our favorite game in steam community market. No money? Just mods.The essential gaming is fun. Enjoy the game and boost your mmr!

Axe - Snowpack Savage

Mod skin Axe - Snowpack Savage rare item Dota 2 Reborn from Fortivus 2017 Treasure. This item consists of : Axe of the Snowpack Savage, Beard of the Snowpack Savage, Armor of the Snowpack Savage, Belt of the Snowpack Savage and Prize of the Snowpack Savage . Mod type: Standart . Hope you guys like this mod and support our favorite game in steam community market. The essence of gaming is fun. No money? Just mods. Enjoy the game and boost your MMR! For installation mod guide: How to install mods with vpk creator . Axe - Snowpack Savage