monthchunks for blogger

unfortunately this took me a long time to get around to. i got the following request in response to my monthchunks for wordpress post:

So is there any way that someone still on Blogger (waves hand in the air with earnest and pleading look on face) could wangle the original javascript to turn the ‘standard archive link into something a little more compact’? I assume this would be code that goes into my custom template in place of the month-by-month links I’ve got there now? Short of a real calendar, the less vertical space used up by my archive links list, the happier a camper I am. Many thanks, I hope! —Leeeny

i developed the monthchunks archive format originally in javascript to modify the display of the links to my blogger archive pages. but since i moved my blog over to wordpress and replaced the javascript with a plugin written in php, i thought the javascript was gone.

of course it completely skipped my mind that my neatlinks sidebar blog is blogger driven, and the monthchunks-style archive links at the bottom of the column are indeed generated by javascript on the client. here’s how to do it.

  1. get the javascript monthchunks-1.0.js into your blog in one of two ways:
    1. if you have the ability to upload files to your web host, grab the the monthchunks javascript above and upload it to your web directory (i put my javascript files in a folder called “scripts”), then add the following line of code before the </head> tag at the top of your current blogger template
      <script type="text/javascript" src="/scripts/monthchunks-1.0.js"></script>

      note: the src attribute assumes the script lives inside a folder called “scripts”—if this is not the case, change it appropriately

    2. if you cannot upload the javascript file to your web host (for instance if you’re using blogspot), add the following lines of code before the </head> tag at the top of your current blogger template
      <script type="text/javascript">
      // paste function here
      </script>

      then left-click the “monthchunks” link above, copy the javascript, then paste it where it says // paste function here

  2. update your current template’s archive links output. it may look something like this:
    <BloggerArchives>
      <a href='<$BlogArchiveURL$>'><$BlogArchiveName$></a>
    </BloggerArchives>
    

    replace it with this:

    <script type="text/javascript">
    var archives = new Array();
    <BloggerArchives>archives[archives.length] = new Array('<$BlogArchiveURL$>', '<$BlogArchiveName$>');</BloggerArchives>
    monthchunks(archives);
    </script>
    <noscript><BloggerArchives><a href='<$BlogArchiveURL$>'><$BlogArchiveName$></a> </BloggerArchives></noscript>
    
  3. finally change your archive date settings in blogger (under settings > formatting > archive index date format to the mm/dd setting

and of course, if you run into any problems or have questions, please leave a comment. enjoy.

Feel free to if you found this useful.

10 Comments

Perfecto! You’ve made me so happy. Only thing to note, for anyone who has their Blogger blog hosted on Blogger’s server rather than one of your own, is that you have to have some other location to upload the monthchunks-1.0.js file to, such as ISP user webspace, or any other server you can upload to. Then just put an absolute reference (http://etc) to the location of the file, in place of justin’s relative reference in step 2 above. Thanks again, justin.

no problem and thanks for adding that caveat.

Brian

You could also put the Javascript right in the template and not have to load it from a separate URL.

You’re the BEST! I’m a big fan of MONTHCHUNK! (Got one working with WordPress) but I also have another blog at blogger.com (I was a blogger user but couldn’t resist the awesomeness of WP, so I switched.)

i’ve modified the post to include the excellent suggestion made by brian (my dad). hope that helps.

Kansas

Hey, I couldn’t get it to work. The blogger archive options are daily, weekly, and monthly. Could that be the problem?

Kansas, the script assumes monthly. Hope that helps.

Kansas

Not really, as it produces this: 20em
No
20ob
Oc
20te
Se
20us
Au.
I don’t know enough about javascript to rewrite it.

I’m a dumbass. Nevermind.

Oh wow, it works, you figured it out. I’m glad to hear it. I figured Blogger had changed something and the JavaScript was just going screwy.

Name

Email (optional)

Blog (optional)