Cara Membuat Related Posts di bawah Postingan 2

Related Posts pada sebagian template, mungkin sudah ada pengaturannya, sedangkan bagi tmpalate default bawaan blogger.... yach seperti yang punya saya ini, maka kita harus sedikit kreatif. Karena dengan memasangkan 'Related Posts' pembaca dapat melihat judul postingan kita yang satu label dan diharapkan terus membaca dan tidak pergi dari Blog kita (Postingannya juga harus menarik yach).

Sebelumnya sya pernah juga membuat postingan mengenai 'Related Posts' dengan perantara pihak ke-tiga. Akan tetapi pada kesempatan ini saya akan memberi sedikit ulasan mengenai pembuatan 'related posts' dengan cara manual (edit HTML). Ada banyak pengaturan HTML dan CSS untuk membuat 'Related Posts' ini, akan tetapi saya menawarkan seperti yang saya pakai.

Adapun langkahnya :

  • Cari kode ini </head>
  • Copy kode di bawah ini dan letakan sebelum kode di atas (</head>)
<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 {
color : #940f04;
font-size : 20px;
font-weight : normal;
margin : 5px 7px 0;
padding : 0 0 5px;
}
#related-posts a {
color : #054474;
font-size : 11px;
text-decoration : none;
}
#related-posts a:hover {
color : #054474;
text-decoration : none;
}
#related-posts ul {
border : medium none;
margin : 10px;
padding : 0;
}
#related-posts ul li {
display : block;
background : url("http://www.dogphilosophy.net/graphics/sample1.jpg") no-repeat 0 0;
margin : 0;
padding-top : 0;
padding-right : 0;
padding-bottom : 1px;
padding-left : 16px;
margin-bottom : 5px;
line-height : 2em;
border-bottom:1px dotted #cccccc;
}
</style>
<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>

  • Cari kode <p><data:post.body/></p>
  • Copy kode dibawah ini dan letakan di bawah kode diatas.
<b:if cond='data:blog.pageType == "item"'>
<div id="related-posts">
<h2>Related Posts on <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=10&quot;' type='text/javascript'/></b:if></b:loop> </h2>
<script type='text/javascript'> removeRelatedDuplicates(); printRelatedLabels(); </script></div></b:if>
  • Klik Save Template dan lihat hasilnya.
Catatan
  • Anda bisa menguba kode merah di atas (Related Posts) dengan kalimat yang kalian suka, misalnya Artikel yang berkaitan, recommended posts dll
  • Angka 10 adalah jumlah maksimal untuk related Post yang di tampilkan. Kalian bisa mengubahnya sesuka kalian.
  • Bentuk tulisan dan ukuran serta lebar nya, silakan Anda oprek sendiri dengan mengedit warna biru.
Update.
Apabila penggunaan javascript terlalu panjang, Anda bisa mengubahnya dengan javascipt di bawah ini.

</style>
<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>

Anda ganti dengan javascript
<script src='http://hbhost.googlecode.com/files/Related-posts.js' type='text/javascript'/>

---Sucses for Us---

4 komentar:

  1. Simon Spurr drops a simple black colorway in the brand’s Charlie Square frame. Featuring dark gradient lenses and metal hinges, the achingly slick black shades boast a ’70s sensibility with ed hardy glasses plenty of versatility. They are available now at the MR PORTER online store, priced at $375 USD.Toronto-based retailer Ransom Holding Co. cartier eyeglasses has just teamed up with Portland-based eyewear company Shwood to redesign a limited edition version of the label’s famed “Canby” model. coach sunglass case Using a genuine Canadian oak wood, each pair of glasses is numbered and features Ransom’s signature sword emblem on the frame roberto cavalli eyeglasses with polarized lenses and a special box. Limited to only 50 units, the glasses are currently available for purchase online through d&g white sunglasses the Ransom Holding Co. and Shwood Eyewear web stores.
    To celebrate its 10th anniversary, Hawaii-based sneaker boutique KICKS/HI has teamed up carrera polarized sunglasses with experimental eyewear company Shwood in releasing a limited edition of its signature “Canby” model. Crafted with Hawaii’s prized koa wood, miu miu glasses each pair of this classic silhouette features the wood’s remarkable natural grain texture. Shwood’s engraved logo, customized

    BalasHapus
  2. Italian designer Belle by Sigerson Morrison has created a signature line of ballet flats for Club Monaco, available in five colors: black patent leather, sand Italian leather, latte embossed snakeskin and natural embossed snakeskin.Combining expert craftsmanship with an urban aesthetic, the flats are a quintessential item for ray ban glasses the season—at work, on the weekend and everywhere in between.Pick up a pair at the Flatiron store, 160 Fifth Avenue near 21st Street.Give your look a retro feel with a pair of Ray-Ban shades and a ray ban vintage Timex watch, both now available at Club Monaco.Believe it or not, Ray-Ban has been crafting eyewear since the 1930s. Today, iconic styles like the 1930s ‘Aviator’ and the 1950s ‘Wayfarer’ remain popular trends.The one-of-a-kind Timex ray ban sunglasses watches were hand-selected by Club Monaco designers straight out of London. Add one to your wardrobe for a finishing touch.Varying styles of the Ray-Ban and Timex accessories are available at select Club Monaco stores. See their ray-ban sunglasses entire spring look book, and check out more from Sigerson Morrison and Ray-Ban.
    Dave Meinert, the owner of 5 Point Cafe, explains "I’m a thought leader. First you have to understand the culture of the 5 ray ban wayfarer Point, which is a sometimes seedy, maybe notorious place. People want to go there and be not known ... and definitely don’t want to be secretly filmed or videotaped and immediately put on the Internet."So the ray ban round sunglasses bar bans high-tech glasses with a pretty valid argument. While many people can see the humor in this -- and Meinert sees it too -- others feel as though Google Glasses are going to be "the ray ban sunglasses sale next big thing" and maybe banning them will actually turn off patrons. As of now, people don't seem to care much because the glasses aren't out yet... but if they become really popular? Well 5 Point ray ban sunglasses outlet may have to bend the rules.Google Glasses will be available some time at the end of this year. They will have a pricetag of around $1500.00. Some people think these glasses will just be a gimmick

    BalasHapus
  3. Leave it to Cindy Crawford to pack the perfect suitcase for Coachella weekend. The iconic supermodel played it cool in cutoffs, christian louboutin sale a boho top, and a fringed cardigan that added just enough texture to her look. valentino boots Smartly accessorizing with her sunglasses, leather crossbody bag, and desert booties, it's safe to say christian louboutin store there's not one essential she forgot.While Cindy casually made it through the desert with her christian louboutin Shoes husband, Rande, these photos of her flawless outfit look straight out of a sunny Summer cheap louboutin shoes editorial. Read on to see why Cindy gave the other models and stars a run christian louboutin outlet for their money, style-wise. Then scoop up her trusty separates before you head to any giuseppe zanotti sneakers concert. Trust, you won't feel ill-prepared or underdressed.
    It doesn't take much to notice Hailee authentic christian louboutin outlet Steinfeld's sense of style. There simply isn't an event she shows up to where she christian louboutin outlet doesn't make a statement. But you can tell Hailee's outfits aren't forced — she actually red bottoms shoes loves fashion, and now she's proving her prowess by guest editing the May 2016 issue red bottoms shoes on sale of Harper by Harper's Bazaar. Of course, a bold shoot accompanies Ms. Steinfeld's feature, in christian louboutin shoes which she models some of her go-to designers including Fendi and Miu Miu.Plus, Hailee revealed red bottom shoes christian louboutin

    BalasHapus

Cara menulis komentar
1. Ketik komentar Anda pada Kolom dibawah
2. Pilih account login Anda (Email)
3. Klik 'Poskan Komentar'
Saya harap Anda jangan berkomentar dengan bentuk SPAM, karena tidak akan dipublikasina. Jika Anda ingin menautkan link Blog, silakan be Follower (Baca:Cara menjadi followers blog)

Lebih diutamakan pada komentar yang bersifat ingin tahu (bertanya).