How do I change the order of my archive links? - Blogger help, tips and hacks

How do I change the order of my archive links?

Note: This article is for classic templates. If your blog is using Layouts, this feature is supported as an option by the archive page element. (Select the "flat list" option and uncheck "show oldest posts first.")

By default, the archive links code lists your archives with the oldest ones at the top and the newest at the bottom. It's possible to reverse this, though, with a bit of Javascript. Here's what it would look like:

To do this on your blog, you'll just replace the default'>">default archive code with the following:

<ul class="archive-list">
<script type="text/javascript">

var archives = new Array();

archives[archives.length] = new Array('<$BlogArchiveURL$>', '<$BlogArchiveName$>');

for (var i=archives.length-1;i>=0;i--)
document.write('<li><a href=\"' + archives[i][0] + '\">' + archives[i][1] + '</a></li>');


What's happening here is that the <BloggerArchives> tags are cycling through all the archive links as usual, but rather than just printing them out, we're storing them in a Javascript array. Then, using the for loop, we cycle through them all backwards, and this time we go ahead and print them out, in their new order. You can copy this code directly into your template, without having to make any modifications.


  • This code prints out the links as an unordered list. If you want to use a different format, simply replace the <ul> and <li> tags with the appropriate HTML for your design.
  • If you're worried about people who don't have Javascript enabled on their browsers, you can keep the original archive code in your template as well. Just put it inside <noscript> tags, so that it only appears in browsers without Javascript. Like this:
    <a href='<$BlogArchiveURL$>'><$BlogArchiveName$></a>
Did you like this article ?
Subscribe to my RSS feed and get more blogging tips, Plus a lot more great advice to help your blog.

Related Posts by Categories

Widget by John
  1. 0 comments: Responses to “ How do I change the order of my archive links? ”


 Subscribe in a reader

Latest Free Blogger Templates
Template 01 Template - 02 see more templates
demo - 01 demo - 02
Click here for Demo Click here for Demo How to Installed Tips
Download the Temp01 Download the Temp-2  

Blogger Help: Recent Comments


 Subscribe to Bloggers Help via RSS
Add to Technorati Favorites