Jika kemaren saya membuat tutorial mengenai Cara Membuat Index Halaman Blog atau Mengganti "Older Posts" Dengan Angka, maka kali ini kita akan membahas cara Membuat Navigasi Ala Google di Blogspot. Sebenarnya navigasi ini seperti biasa, namun ini khas ala google, tau kan? Kalo masih belum tahu, lihat gambar di bawah ini:
Diblog pun bisa seperti ini,Sudah paham kan? Jika sobat berminat untuk membuatnya, silahkan ikuti tutorial berikut: 1. Login ke akun blogger sobat. 2. Pergi ke tab rancangan, lalu edit HTML. 3. Cari kode ]]></b:skin> kemudian taruh kode berikut ini TEPAT di atasnya:
4. Sekarang cari lagi kode </body>. 5. Jika sudah ketemu, copy dan paste kode berikut TEPAT di atasnya:
Klik Show Untuk Membuka Spoiler
<script type='text/javascript'>
var home_page_url = location.href;
var pageCount=10; var displayPageNum=6; var upPageWord ='Previous'; var downPageWord ='Next';
function showpageCount(json) { var thisUrl = home_page_url; var htmlMap = new Array(); var thisNum = 1; var postNum=1; var itemCount = 0; var fFlag = 0; var eFlag = 0; var html= ''; var upPageHtml =''; var downPageHtml ='';
htmlMap[htmlMap.length]='/'; postNum++;
for(var i=pageCount-1, post; post = json.feed.entry[i]; i=i+pageCount) {
var timestamp1 = post.published.$t.substring(0,19)+post.published.$t.substring(23,29); timestamp = encodeURIComponent(timestamp1); var title = post.title.$t; if(thisUrl.indexOf(timestamp)!=-1 ){ thisNum = postNum; }
if(thisNum>1){ html = ''+upPageHtml+' '+html +' '; } html2 = '<table id="nav" style="margin: auto auto 1.4em; border-collapse: collapse;text-align: center; direction: ltr;" align="center"><tbody><tr valign="top"><td class="b">Page ('+(postNum-1)+') </td><td class="b">'; html3 = '</tr></tbody></table>'; html = html2+html;
if(thisNum<(postNum-1)){ html += downPageHtml; }else{ html += '<td class="b"><span class="csb" style="background-position: -76px 0pt; width: 42px;"></span></td>'; }
if(postNum==1) postNum++; html += html3+ '</div>';
var pageArea = document.getElementsByName("pageArea"); var blogPager = document.getElementById("blog-pager");
if(postNum <= 2){ html =''; }
for(var p =0;p< pageArea.length;p++){ pageArea[p].innerHTML = html; }
if(pageArea&&pageArea.length>0){ html =''; }
if(blogPager){ blogPager.innerHTML = html; }
}
function showpageCount2(json) {
var thisUrl = home_page_url; var htmlMap = new Array(); var isLablePage = thisUrl.indexOf("/search/label/")!=-1; var thisLable = isLablePage ? thisUrl.substr(thisUrl.indexOf("/search/label/")+14,thisUrl.length) : ""; thisLable = thisLable.indexOf("?")!=-1 ? thisLable.substr(0,thisLable.indexOf("?")) : thisLable; var thisNum = 1; var postNum=1; var itemCount = 0; var fFlag = 0; var eFlag = 0; var html= ''; var upPageHtml =''; var downPageHtml ='';
var labelHtml = '<a href="/search/label/'+thisLable+'?&max-results='+pageCount+'">'; var thisUrl = home_page_url;
htmlMap[htmlMap.length]=labelHtml; postNum++;
for(var i=pageCount-1, post; post = json.feed.entry[i]; i=i+pageCount) { var timestamp1 = post.published.$t.substring(0,19)+post.published.$t.substring(23,29); timestamp = encodeURIComponent(timestamp1);
if(thisNum>1){ if(!isLablePage){ html = ''+upPageHtml+' '+html +' '; }else{ html = ''+upPageHtml+' '+html +' '; } }
html2 = '<table id="nav" style="margin: auto auto 1.4em; border-collapse: collapse;text-align: center; direction: ltr;" align="center"><tbody><tr valign="top"><td class="b">Page ('+(postNum-1)+') </td><td class="b">'; html3 = '</tr></tbody></table>'; html = html2+html;
if(thisNum<(postNum-1)){ html += downPageHtml; }else{ html += '<td class="b"><span class="csb" style="background-position: -76px 0pt; width: 42px;"></span></td>'; }
if(postNum==1) postNum++; html += html3+ '</div>';
var pageArea = document.getElementsByName("pageArea"); var blogPager = document.getElementById("blog-pager");
if(postNum <= 2){ html =''; }
for(var p =0;p< pageArea.length;p++){ pageArea[p].innerHTML = html; }
if(pageArea&&pageArea.length>0){ html =''; }
if(blogPager){ blogPager.innerHTML = html; }
}
</script>
<script type='text/javascript'>
var thisUrl = home_page_url; if (thisUrl.indexOf("/search/label/")!=-1){ if (thisUrl.indexOf("?updated-max")!=-1){ var lblname1 = thisUrl.substring(thisUrl.indexOf("/search/label/")+14,thisUrl.indexOf("?updated-max")); }else{ var lblname1 = thisUrl.substring(thisUrl.indexOf("/search/label/")+14,thisUrl.indexOf("?&max")); } }
var home_page = "/"; if (thisUrl.indexOf("?q=")==-1 && thisUrl.indexOf(".html")==-1){ if (thisUrl.indexOf("/search/label/")==-1){ document.write('<script src="'+home_page+'feeds/posts/summary?alt=json-in-script&callback=showpageCount&max-results=99999" ><\/script>') }else{document.write('<script src="'+home_page+'feeds/posts/full/-/'+lblname1+'?alt=json-in-script&callback=showpageCount2&max-results=99999" ><\/script>') } } </script>
6. Save template, dan lihat hasilnya!
Membuat Navigasi Ala Google di Blogspot
Reviewed by budi daily
on
July 24, 2012
Rating: 5
Post a Comment