How to Create a Sitemap or Table of Contents as webpage in Blogger

CodeGuy
March 18, 2016

You get most of the widgets to generate a How to Create a Sitemap or Table of Contents in Blogger just like here. But, think of a (say TOC) static home page or web page which is linked to the menu bar as in this site.
Collecting the permalinks of news posts every time and updating to a TOC is not feasible and time consuming, and will not stay as updated often. While, the contents of TOC must be dynamically generated and tagged to a page. Blogger feed JSON can be utilized to extract the information using javascript but blogger doesn't not allow you to insert  SCRIPT tags which would serve the purpose. Thus generating a dynamically updated list of TOC in a static web page.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<script language="JavaScript" type="text/javascript">
    <!-- Begin
 function mycallback(jsons) {
 document.write('<ol>');
    for (var i = 0; i < jsons.feed.entry.length; i++) {
      for (var j = 0; j < jsons.feed.entry[i].link.length; j++) {
        if (jsons.feed.entry[i].link[j].rel == 'alternate') {
          var postUrl = jsons.feed.entry[i].link[j].href;
          var postTitle = jsons.feed.entry[i].link[j].title;

      var item = '<li><a href=' + postUrl + '>' + postTitle + '</a></li>';
      document.write(item);

        }
      }
    }
 document.write('</ol>');
  }
// End </script><script src="http://cybernol.blogspot.in/feeds/posts/summary?&amp;alt=json-in-script&amp;callback=mycallback"></script>

0 comments

Do not spam.

Like us on Facebook

Blog Archive