More from the web

Wednesday, 1 July 2015

Creating an HTML Sitemap Page in Blogger

Creating Sitemap Page for All Labels

If you want to show all of your blog posts at same page then follow below steps one by one.
  1. Go to your blogger blog.
  2. Now Navigate to Pages > New Page > Blank Page.
  3. Switch it to HTML mode.
  4. Paste below code in the post body.

<script type=”text/javascript”>
var numposts = 100;
var standardstyling = true;
function showrecentposts(json) {
  for (var i = 0; i < numposts; i++) {
    var entry = json.feed.entry[i];
    var posttitle = entry.title.$t;
    var posturl;
    if (i == json.feed.entry.length) break;
    for (var k = 0; k < entry.link.length; k++) {
      if (entry.link[k].rel == ‘alternate’) {
        posturl = entry.link[k].href;
        break;
      }}
    posttitle = posttitle.link(posturl);
    if (standardstyling) document.write(‘<li>’);
    document.write(posttitle);}
    if (standardstyling) document.write(‘</li>’);
}
</script>
<ul>
<script src=”http://www.blogname.com/feeds/posts/default?orderby=published&amp;alt=json-in-script&amp;callback=showrecentposts&amp;max-results=999″></script>
</ul>
  1. Replace www.blogname.com with your own blog URL.
  2. Click Publish button.
  3. That’s it.

Creating Sitemap Page for Particular Label

If you want to show posts from specific labels, then instead of the above code, use below code.

<script type=”text/javascript”>
var numposts = 100;
var standardstyling = true;
function showrecentposts(json) {
  for (var i = 0; i < numposts; i++) {
    var entry = json.feed.entry[i];
    var posttitle = entry.title.$t;
    var posturl;
    if (i == json.feed.entry.length) break;
    for (var k = 0; k < entry.link.length; k++) {
      if (entry.link[k].rel == ‘alternate’) {
        posturl = entry.link[k].href;
        break;
      }}
    posttitle = posttitle.link(posturl);
    if (standardstyling) document.write(‘<li>’);
    document.write(posttitle);}
    if (standardstyling) document.write(‘</li>’);
}
</script>
<ul>
<script src=”http://www.blognamecom/feeds/posts/default/-/Label%20Name?orderby=published&amp;alt=json-in-script&amp;callback=showrecentposts&amp;max-results=999″></script>
</ul>
Replace www.blogname.com with your blog URL and Label%20Name with your label name.

Remember: If you are using single word as your label name like “SEO” then put SEO there but if you are using more than one word, then put %20 between each word.
For example: if the label name is Blogger Tricks, then put Blogger%20Tricks.
The label name is case sensitive, so take care of it. Means don’t put seo in the place of SEO. The code will not work in that case.

Final Words!


This was the little trick about how to make HTML sitemap page in Blogger for particular label or for all labels. I hope you guys like this tutorial. Feel free to leave comment below this post to share your views and feedback. Thanks and Happy Blogging!