[Simple] Halaman Sitemap User - Blogger

Discussion in 'Blogger' started by Fahmi, Oct 4, 2014.

  1. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Hello, nah kali ini saya akan share memasang halaman sitemap untuk user pada platform Blogger, rencana nya akan Inline javascript, kemungkinan akan mempercepat proses load sitemap nya, untuk kode mungkin kita semua tahu bagaimana kode sitemap yang beredar diluar sana :D saya coba membuang yg tidak penting dan mengkompress nya, berikut cara nya:

    Edit html dan pasang ini sebelum Head :
    Code:
    <b:if cond='data:blog.pageType == &quot;static_page&quot;'><script type='text/javascript'>
    //<![CDATA[
    function loadtoc(e){function t(){if("entry"in e.feed){var t=e.feed.entry.length;numberfeed=t;ii=0;for(var n=0;n<t;n++){var r=e.feed.entry[n];var i=r.title.$t;var s=r.published.$t.substring(0,10);var o;for(var u=0;u<r.link.length;u++){if(r.link[u].rel=="alternate"){o=r.link[u].href;break}}var a="";for(var u=0;u<r.link.length;u++){if(r.link[u].rel=="enclosure"){a=r.link[u].href;break}}var f="";if("category"in r){for(var u=0;u<r.category.length;u++){f=r.category[u].term;var l=f.lastIndexOf(";");if(l!=-1){f=f.substring(0,l)}postLabels[ii]=f;postTitle[ii]=i;postUrl[ii]=o;ii=ii+1}}}}}t();sortBy="titleasc";sortPosts(sortBy);sortlabel();tocLoaded=true;displayToc2();document.write()}function filterPosts(e){scroll(0,0);postFilter=e;displayToc(postFilter)}function allPosts(){sortlabel();postFilter="";displayToc(postFilter)}function sortPosts(e){function t(e,t){var n=postTitle[e];postTitle[e]=postTitle[t];postTitle[t]=n;var n=postUrl[e];postUrl[e]=postUrl[t];postUrl[t]=n;var n=postLabels[e];postLabels[e]=postLabels[t];postLabels[t]=n;var n=postBaru[e];postBaru[e]=postBaru[t];postBaru[t]=n}for(var n=0;n<postTitle.length-1;n++){for(var r=n+1;r<postTitle.length;r++){if(e=="titleasc"){if(postTitle[n]>postTitle[r]){t(n,r)}}if(e=="titledesc"){if(postTitle[n]<postTitle[r]){t(n,r)}}if(e=="dateoldest"){if(postDate[n]>postDate[r]){t(n,r)}}if(e=="datenewest"){if(postDate[n]<postDate[r]){t(n,r)}}if(e=="orderlabel"){if(postLabels[n]>postLabels[r]){t(n,r)}}}}}function sortlabel(){sortBy="orderlabel";sortPosts(sortBy);var e=0;var t=0;while(t<postTitle.length){temp1=postLabels[t];firsti=e;do{e=e+1}while(postLabels[e]==temp1);t=e;sortPosts2(firsti,e);if(t>postTitle.length){break}}}function sortPosts2(e,t){function n(e,t){var n=postTitle[e];postTitle[e]=postTitle[t];postTitle[t]=n;var n=postUrl[e];postUrl[e]=postUrl[t];postUrl[t]=n;var n=postLabels[e];postLabels[e]=postLabels[t];postLabels[t]=n}for(var r=e;r<t-1;r++){for(var i=r+1;i<t;i++){if(postTitle[r]>postTitle[i]){n(r,i)}}}}function displayToc2(){var e=0;var t=0;while(t<postTitle.length){temp1=postLabels[t];document.write('<p style="background: #f7f7f7;padding: 5px;" />');document.write('<span class="labl"><span>Label :  </span><a href="/search/label/'+temp1+'">'+temp1+"</a></span><ul class='postname'>");firsti=e;do{document.write("<li>");document.write('<a href="'+postUrl[e]+'">'+postTitle[e]+"</a>");document.write("</li>");e=e+1}while(postLabels[e]==temp1);t=e;document.write("</ul>");sortPosts2(firsti,e);if(t>postTitle.length){break}}}var postTitle=new Array;var postUrl=new Array;var postLabels=new Array;var postBaru=new Array;var sortBy="titleasc";var tocLoaded=false;var numChars=250;var postFilter="";var numberfeed=0;document.write("")
    //]]>
    </script><b:else/></b:if>

    - Lalu buatlah page sitemap pada menu page, dan pasang ini :
    Code:
    <script src="http://munkyk.blogspot.com/feeds/posts/default?max-results=9999&amp;alt=json-in-script&amp;callback=loadtoc"></script>
    note: rubah nama domain dengan domainmu.

    Untuk demo dan lihat seberapa cepat generate sitemap page nya, cek disini : http://munkyk.blogspot.com/ dan lihat saja halaman sitemap nya :D

    Monggo di coba dan semoga berguna :)
     
    Last edited: Oct 4, 2014
  2. Grant Verleend

    Grant Verleend Active Member

    Joined:
    Sep 10, 2014
    Messages:
    1,234
    Likes Received:
    35
    Trophy Points:
    48
    Google+:
    Nyoba dulu ah, kayaknya oke nie, ditambah lagi codingnya simple
     
  3. Ardilas

    Ardilas Super Level

    Joined:
    Feb 18, 2013
    Messages:
    4,243
    Likes Received:
    317
    Trophy Points:
    83
    Google+:
  4. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Ya, ini versi inline JS :D jadi gk panggil external file hehehe
     
  5. Ardilas

    Ardilas Super Level

    Joined:
    Feb 18, 2013
    Messages:
    4,243
    Likes Received:
    317
    Trophy Points:
    83
    Google+:
    Sip deh.
     
  6. asli3rut

    asli3rut Member

    Joined:
    Sep 6, 2014
    Messages:
    641
    Likes Received:
    44
    Trophy Points:
    28
    harus dicoba ni, thanks gan infonya bermanfaat kayakna buat nambah referensi
     
Loading...

Share This Page