Saturday, October 19, 2019

How to Create an Archive in Blogger

  1. Make Page
  2. Add This Code in HTML mode.
  3. Publish That page.
  4. Remove "YOURBLOGHERE"  And Add your blog name.

First Script 

 <script type="text/javascript">
function LoadTheArchive(TotalFeed)
{
    var PostTitles = new Array();
    var PostURLs = new Array();
    var PostYears = new Array();
    var PostMonths = new Array();
    var PostDays = new Array();
    if("entry" in TotalFeed.feed)
    {
 var PostEntries=TotalFeed.feed.entry.length;
 for(var PostNum=0; PostNum<PostEntries ; PostNum++)
 {
     var ThisPost = TotalFeed.feed.entry[PostNum];
     PostTitles.push(ThisPost.title.$t);
     PostYears.push(ThisPost.published.$t.substring(0,4));
     PostMonths.push(ThisPost.published.$t.substring(5,7));
     PostDays.push(ThisPost.published.$t.substring(8,10));
     var ThisPostURL;
     for(var LinkNum=0; LinkNum < ThisPost.link.length; LinkNum++)
     {
  if(ThisPost.link[LinkNum].rel == "alternate")
  {
      ThisPostURL = ThisPost.link[LinkNum].href;
      break
  }
     }
     PostURLs.push(ThisPostURL);
 }
    }
    DisplaytheTOC(PostTitles,PostURLs,PostYears,PostMonths,PostDays);
}

function DisplaytheTOC(PostTitles,PostURLs,PostYears,PostMonths,PostDays)
{
    var MonthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];
    var NumberOfEntries=PostTitles.length;

    var currentMonth = "";
    var currentYear = "";

    for(var EntryNum = 0; EntryNum < NumberOfEntries; EntryNum++)
    {
 NameOfMonth = MonthNames[parseInt(PostMonths[EntryNum],10)-1]

 if (currentMonth != NameOfMonth || currentYear != PostYears[EntryNum]) {
  currentMonth = NameOfMonth;
  currentYear = PostYears[EntryNum];

  document.write("<div class='dateStyle'><br />" + currentMonth+" "+currentYear+" </div>");
 }

  document.write('<a href ="'+PostURLs[EntryNum]+'"><div class=dayStyle>'+parseInt(PostDays[EntryNum],10)+":&nbsp;&nbsp;</div> "+PostTitles[EntryNum]+"</a><br />");
    }
}
</script>

<script src="http://YOURBLOGHERE.blogspot.com/feeds/posts/default?max-results=500&amp;alt=json-in-script&amp;callback=LoadTheArchive" />
</script>

<!--CUSTOMIZATION-->
<style type="text/css">
.dateStyle {
     color:#000;
     font-weight:bold;
     font-size: 15px;
     font-family: Arial, sans-serif;
     margin: 0;
}

.dayStyle {
     color:#000;
     font-weight:bold;
     font-family: Arial, sans-serif;
     display: inline-block;
}

</style>

-------------------------------------------------------------------------------------------------------------------------------

Second   Script


<p>&nbsp;</p>
<pre>&lt;script type="text/javascript"&gt;
function LoadTheArchive(TotalFeed)
{
    var PostTitles = new Array();
    var PostURLs = new Array();
    var PostYears = new Array();
    var PostMonths = new Array();
    var PostDays = new Array();
    if("entry" in TotalFeed.feed)
    {
 var PostEntries=TotalFeed.feed.entry.length;
 for(var PostNum=0; PostNum &lt; PostEntries; PostNum++)
 {
     var ThisPost = TotalFeed.feed.entry[PostNum];
     PostTitles.push(ThisPost.title.$t);
     PostYears.push(ThisPost.published.$t.substring(0,4));
     PostMonths.push(ThisPost.published.$t.substring(5,7));
     PostDays.push(ThisPost.published.$t.substring(8,10));
     var ThisPostURL;
     for(var LinkNum=0; LinkNum &lt; ThisPost.link.length; LinkNum++)
     {
  if(ThisPost.link[LinkNum].rel == "alternate")
  {
      ThisPostURL = ThisPost.link[LinkNum].href;
      break
  }
     }
     PostURLs.push(ThisPostURL);
 }
    }
    DisplaytheTOC(PostTitles,PostURLs,PostYears,PostMonths,PostDays);
}

function DisplaytheTOC(PostTitles,PostURLs,PostYears,PostMonths,PostDays)
{
    var MonthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];
    var NumberOfEntries=PostTitles.length;

    var currentMonth = "";
    var currentYear = "";

    for(var EntryNum = 0; EntryNum &lt; NumberOfEntries; EntryNum++)
    {
 NameOfMonth = MonthNames[parseInt(PostMonths[EntryNum],10)-1]

 if (currentMonth != NameOfMonth || currentYear != PostYears[EntryNum]) {
  currentMonth = NameOfMonth;
  currentYear = PostYears[EntryNum];

  document.write("&lt;br&gt;&lt;div class='dateStyle'&gt;" + currentMonth + " " + currentYear + "&lt;/div&gt;");
 }
var parsed_day = parseInt(PostDays[EntryNum],10) &gt; 9 ? "" + parseInt(PostDays[EntryNum],10): "0" + parseInt(PostDays[EntryNum],10);
  document.write("&lt;div class='dayStyle'&gt;" + parsed_day + ":&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;a href='" + PostURLs[EntryNum] + "'&gt;" + PostTitles[EntryNum] + "&lt;/a&gt;&lt;br&gt;");
    }
}
&lt;/script&gt;

&lt;script src="/feeds/posts/summary?alt=json-in-script&amp;amp;max-results=150&amp;amp;start-index=1&amp;amp;callback=LoadTheArchive" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="/feeds/posts/summary?alt=json-in-script&amp;amp;max-results=150&amp;amp;start-index=151&amp;amp;callback=LoadTheArchive" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="/feeds/posts/summary?alt=json-in-script&amp;amp;max-results=150&amp;amp;start-index=301&amp;amp;callback=LoadTheArchive" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="/feeds/posts/summary?alt=json-in-script&amp;amp;max-results=150&amp;amp;start-index=451&amp;amp;callback=LoadTheArchive" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="/feeds/posts/summary?alt=json-in-script&amp;amp;max-results=150&amp;amp;start-index=601&amp;amp;callback=LoadTheArchive" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="/feeds/posts/summary?alt=json-in-script&amp;amp;max-results=150&amp;amp;start-index=851&amp;amp;callback=LoadTheArchive" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="/feeds/posts/summary?alt=json-in-script&amp;amp;max-results=150&amp;amp;start-index=1001&amp;amp;callback=LoadTheArchive" type="text/javascript"&gt;
&lt;/script&gt;
&lt;!--CUSTOMIZATION--&gt;
&lt;style type="text/css"&gt;
.dateStyle {
     color:#000;
     font-weight:bold;
     font-size: 15px;
     font-family: Arial, sans-serif;
     margin: 0;
}

.dayStyle {
     color:#000;
     font-weight:bold;
     font-family: Arial, sans-serif;
     display: inline-block;
}
.post-header{display:none;}
&lt;/style&gt;<br /><br /><br /><br /></pre>
<p>&nbsp;</p>


No comments:

Post a Comment