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 )
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="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script> if ( $('.archivedate').hasClass('expanded') ) { $('.archivedate').removeClass('expanded'); $('.archivedate').addClass('collapsed'); } </script>
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
Prayag..you 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 (http://sedatkurtulus.blogspot.com/2010/05/keep-archive-hierarchy-collapsed-on.html).
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.
Thanks for this hack!
Will this hack work on wordpress if I use archive there too ?
Thanks for this code. Worked great on my mobile/desktop website.
http://calcunico.blogspot.com
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?
is there a way to edit the little arrowheads? I moved mine to a static page but the arrowheads are gone now
http://chefuy.blogspot.com/p/archive.html
Thanks!
I finally found the easiest way here and working very well on my blog.
http://super-gratisan.blogspot.com
Thank you very much
WOW! Thanks man! Worked like a charm!
How can I do the expand all (Year and month). in archive?
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
Hi,
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?
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.