Advertisement
Guest User

itfixi.com html sitemap tutorial

a guest
May 16th, 2021
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2.  
  3. <!-- itfixi.com tutorial for blogger html sitemap -->
  4.  
  5.  
  6. var postTitle = new Array();
  7. var postUrl = new Array();
  8. var postPublished = new Array();
  9. var postDate = new Array();
  10. var postLabels = new Array();
  11. var postRecent = new Array();
  12. var sortBy = "titleasc";
  13. var numberfeed = 0;
  14.  
  15. function bloggersitemap(a) {
  16.     function b() {
  17.         if ("entry" in a.feed) {
  18.             var d = a.feed.entry.length;
  19.             numberfeed = d;
  20.             ii = 0;
  21.             for (var h = 0; h < d; h++) {
  22.                 var n = a.feed.entry[h];
  23.                 var e = n.title.$t;
  24.                 var m = n.published.$t.substring(0, 10);
  25.                 var j;
  26.                 for (var g = 0; g < n.link.length; g++) {
  27.                     if (n.link[g].rel == "alternate") {
  28.                         j = n.link[g].href;
  29.                         break
  30.                     }
  31.                 }
  32.                 var o = "";
  33.                 for (var g = 0; g < n.link.length; g++) {
  34.                     if (n.link[g].rel == "enclosure") {
  35.                         o = n.link[g].href;
  36.                         break
  37.                     }
  38.                 }
  39.                 var c = "";
  40.                 if ("category" in n) {
  41.                     for (var g = 0; g < n.category.length; g++) {
  42.                         c = n.category[g].term;
  43.                         var f = c.lastIndexOf(";");
  44.                         if (f != -1) {
  45.                             c = c.substring(0, f)
  46.                         }
  47.                         postLabels[ii] = c;
  48.                         postTitle[ii] = e;
  49.                         postDate[ii] = m;
  50.                         postUrl[ii] = j;
  51.                         postPublished[ii] = o;
  52.                         if (h < 10) {
  53.                             postRecent[ii] = true
  54.                         } else {
  55.                             postRecent[ii] = false
  56.                         }
  57.                         ii = ii + 1
  58.                     }
  59.                 }
  60.             }
  61.         }
  62.     }
  63.     b();
  64.     sortBy = "titledesc";
  65.     sortPosts(sortBy);
  66.     sortlabel();
  67.     displayToc();
  68. }
  69.  
  70. function sortPosts(d) {
  71.     function c(e, g) {
  72.         var f = postTitle[e];
  73.         postTitle[e] = postTitle[g];
  74.         postTitle[g] = f;
  75.         var f = postDate[e];
  76.         postDate[e] = postDate[g];
  77.         postDate[g] = f;
  78.         var f = postUrl[e];
  79.         postUrl[e] = postUrl[g];
  80.         postUrl[g] = f;
  81.         var f = postLabels[e];
  82.         postLabels[e] = postLabels[g];
  83.         postLabels[g] = f;
  84.         var f = postPublished[e];
  85.         postPublished[e] = postPublished[g];
  86.         postPublished[g] = f;
  87.         var f = postRecent[e];
  88.         postRecent[e] = postRecent[g];
  89.         postRecent[g] = f
  90.     }
  91.  
  92.     for (var b = 0; b < postTitle.length - 1; b++) {
  93.         for (var a = b + 1; a < postTitle.length; a++) {
  94.             if (d == "titleasc") {
  95.                 if (postTitle[b] > postTitle[a]) {
  96.                     c(b, a)
  97.                 }
  98.             }
  99.             if (d == "titledesc") {
  100.                 if (postTitle[b] < postTitle[a]) {
  101.                     c(b, a)
  102.                 }
  103.             }
  104.             if (d == "dateoldest") {
  105.                 if (postDate[b] > postDate[a]) {
  106.                     c(b, a)
  107.                 }
  108.             }
  109.             if (d == "datenewest") {
  110.                 if (postDate[b] < postDate[a]) {
  111.                     c(b, a)
  112.                 }
  113.             }
  114.             if (d == "orderlabel") {
  115.                 if (postLabels[b] > postLabels[a]) {
  116.                     c(b, a)
  117.                 }
  118.             }
  119.         }
  120.     }
  121. }
  122.  
  123. function sortlabel() {
  124.     sortBy = "orderlabel";
  125.     sortPosts(sortBy);
  126.     var a = 0;
  127.     var b = 0;
  128.     while (b < postTitle.length) {
  129.         temp1 = postLabels[b];
  130.         firsti = a;
  131.         do {
  132.             a = a + 1
  133.         } while (postLabels[a] == temp1);
  134.         b = a;
  135.         sortPosts2(firsti, a);
  136.         if (b > postTitle.length) {
  137.             break
  138.         }
  139.     }
  140. }
  141.  
  142. function sortPosts2(d, c) {
  143.     function e(f, h) {
  144.         var g = postTitle[f];
  145.         postTitle[f] = postTitle[h];
  146.         postTitle[h] = g;
  147.         var g = postDate[f];
  148.         postDate[f] = postDate[h];
  149.         postDate[h] = g;
  150.         var g = postUrl[f];
  151.         postUrl[f] = postUrl[h];
  152.         postUrl[h] = g;
  153.         var g = postLabels[f];
  154.         postLabels[f] = postLabels[h];
  155.         postLabels[h] = g;
  156.         var g = postPublished[f];
  157.         postPublished[f] = postPublished[h];
  158.         postPublished[h] = g;
  159.         var g = postRecent[f];
  160.         postRecent[f] = postRecent[h];
  161.         postRecent[h] = g
  162.     }
  163.     for (var b = d; b < c - 1; b++) {
  164.         for (var a = b + 1; a < c; a++) {
  165.             if (postTitle[b] > postTitle[a]) {
  166.                 e(b, a)
  167.             }
  168.         }
  169.     }
  170. }
  171.  
  172. function displayToc() {
  173.     var a = 0;
  174.     var b = 0;
  175.     while (b < postTitle.length) {
  176.         temp1 = postLabels[b];
  177.         document.write("");
  178.         document.write('<div class="post-archive"><h4>' + temp1 + '</h4><div class="ct-columns">');
  179.         firsti = a;
  180.         do {
  181.             document.write("<p>");
  182.             document.write('<a " href="' + postUrl[a] + '">' + postTitle[a] + "");
  183.             if (postRecent[a] == true) {
  184.                 document.write(' - <strong><span>New!</span></strong>')
  185.             }
  186.             document.write("</a></p>");
  187.             a = a + 1
  188.         } while (postLabels[a] == temp1);
  189.         b = a;
  190.         document.write("</div></div>");
  191.         sortPosts2(firsti, a);
  192.         if (b > postTitle.length) {
  193.             break
  194.         }
  195.     }
  196. }
  197.  
  198. </script>
  199.  
  200. <script src="https://www.<b>YOUR-BLOG-SITE</b>/feeds/posts/summary?alt=json-in-script&max-results=9999&callback=bloggersitemap" type="text/javascript"></script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement