Blog Archive links Collapsed by Default Hack

blog archive widget hack

If you are using the Hierarchy style for your Blog Archive widget then you must have faced the problem of auto expansion of drop-down list of a particular month which is currently in the calendar or to which the opened post belongs. This simple hack solves that problem by making all the nodes in the hierarchy to be collapsed by default(As seen in the above picture ). This can be simply added by the One Click Installer or manually.


Prerequisites for this to Work
Before you apply this remember that you have to have a Blog Archive Widget present and the Style has to be set to Hierarchy (as shown in picture below )

blog archive widget config blogger

Applying this to your Blog

To add using One Click Installer Method

Or just add the following Code in your Blog (preferably before the </body> tag in the Edit HTML of the Template tab )

<script src=""></script>
if ( $('.archivedate').hasClass('expanded') ) 

What this code does
It firstly checks if a element having class name "archivedate" also has a class "expanded" present in it. If this turns out to be true then it removes the "expanded" class and adds a class named "collapsed" .

If you face any problem implementing it in your blog then feel free to ask via comments

Written by Prayag Verma

A self proclaimed Blogger Evangelist. He has been blogging for the past 5 years and likes to help people having problems with Blogger . Get more from Prayag on and Twitter

Email Newsletter

Like what you read here in this post ?
Get new posts delivered straight to your inbox

Post a Comment are master of tutorial..really I like it.

Usefull tips. i'll aply to my blog.

Tank you very much my friend.

Thank you! This was way easier to install than the other code (

Mike said...

Hey Prayag! Works great, thanks! The only thing I noticed is that the little triangle button (that signifies collapsed or not) stays "expanded", is there any way to fix this? Not a big deal though!

Bro This is working very well but I would Like to informs you that it Reduced my Traffic. hence It is not good for blogger. This my experience.
Sorry Bro.

Asim Nawaz said...

Thanks for this hack!
Will this hack work on wordpress if I use archive there too ?

nicoyuey said...

Thanks for this code. Worked great on my mobile/desktop website.

Keep sharing. Great work

THANK YOU! Your technique is the easiest and most useful one!

Is there a code to delete the bullet points from it?

Natalie Uy said...

is there a way to edit the little arrowheads? I moved mine to a static page but the arrowheads are gone now

Obet Tea said...

I finally found the easiest way here and working very well on my blog.
Thank you very much

FlakPz said...

Thank you so much, this helps make my blog archive look less messy and more organized!

Tranquil said...

WOW! Thanks man! Worked like a charm!

Ganesh H said...

How can I do the expand all (Year and month). in archive?

Gaurav said...

Hey thanks for this, but the code is little buggy.

The triangle of the code is already down whenever we open the archive though the content is collapsed. It does not look good.

Second how can we collapse only the months and not the year?

Would be grateful for the response.

Warm Regards

Phil Madin said...


Works well, I'm having some trouble finding a way to do the opposite (Like Ganesh asked in 2014)

I would like to display the 6 most recent posts in the header of any page in a Blogger blog.

The archives widget, with a hierarchy style unfortunately doesn't work, any posts which were published in the same month are expanded and displayed, but other months are collapsed and not visible until the href="javascript:void(0)" is triggered by the user clicking on the dropdown ►.

Is there a way to do this?

Zelus said...

Thanks for your simple and useful tip... was frantically googling for tutorials but the others seemed complicated/didn't work.

Also, I took away this tag under 'BlogArchive1' because some of my posts didn't have titles, so now all the posts will be displayed.