Creating an Archives Page in Blogger

Thursday, 9 June 2011

Creating an Archives Page in Blogger

An archives page can be a really useful place for your readers to locate posts of interest or simply browse through your previous posts at leisure.Archive page groups an article headlines in an single page with an sort on month and year of post. It makes your visitor to quickly switch over your post.



Steps to Creating an Archives Page in Blogger
  • Login in to your blogger 
  • Add an new page and select edit html tab and add the below code to your page after replacing highlighted red URL with your blog URL


<script>
var postTitle=new Array();
var postUrl=new Array();
var postMp3=new Array();
var postDate=new Array();
var postYear=new Array();
var postMonth=new Array();
var postYearMonth=new Array();
var postYearMonth2=new Array();
var postLabels=new Array();
var postBaru=new Array();
var sortBy="titleasc";
var tocLoaded=false;
var numChars=250;
var postFilter="";
var numberfeed=0;
var month2=["January","February","March","April","May","June","July","August","September","October","November","December"];
function loadtoc(a){function b(){if("entry" in a.feed){var d=a.feed.entry.length;numberfeed=d;ii=0;
for(var h=0;h<d;h++){var m=a.feed.entry[h];
var e=m.title.$t;var l=m.published.$t.substring(0,10);
var p=m.published.$t.substring(5,7);
var g=m.published.$t.substring(8,10);
var n=month2[parseInt(p,10)-1]+" "+m.published.$t.substring(0,4);
var c="/"+m.published.$t.substring(0,4)+"_"+p+"_01_archive.html";
var j;
for(var f=0;f<m.link.length;f++){if(m.link[f].rel=="alternate")
{j=m.link[f].href;break}}var o="";
for(var f=0;f<m.link.length;f++){if(m.link[f].rel=="enclosure")
{o=m.link[f].href;break}}postTitle.push(e);
postDate.push(l);
postUrl.push(j);
postYearMonth.push(n);
postYearMonth2.push(c);
}}}b();
displayToc2();
}
function displayToc2()
{
var a=0;
var b=0;
while(b<postTitle.length){temp1=postYearMonth[b];document.write("<p/>");
document.write('<p><a href="'+postYearMonth2[b]+'">'+temp1+"</a></p><ul>");
firsti=a;
do
{
document.write("<li>");
document.write('<a href="'+postUrl[a]+'">'+postTitle[a]+"</a>");
document.write("</li>");
a=a+1
}while(postYearMonth[a]==temp1);
b=a;
document.write("</ul>");
if(b>postTitle.length){break}}};
</script>
<script src="http://lodge4hacker.blogspot.com/feeds/posts/default?max-results=500&amp;alt=json-in-script&amp;callback=loadtoc">
</script>
Note:
Select compose setting as "Interpret typed HTML"
Select Edit HTML Setting as "Convert newlines to <br />s"
Reader Comments is optional (either allow or Do not allow)


!!THERE IS NO HIDDEN JAVA SCRIPT OR ADS IN OUR ARCHIVE PAGE SCRIPT !!

Home