How to have widgets on the sidebar expanded by default

Widgets on the sidebar collapsed by default in Google Blogger
In the "Contempo" theme - like in some other themes - the expandable / collapsible widgets on the sidebar such as "Blog Archive" and "Labels" are usually collapsed when the page loads.

You can, of course, expand each of them manually, but until you do, they are collapsed.

If you - like me - don't like your sidebar widgets collapsed by default, please read on to find out how you can "uncollapse" them, that is, make them expanded by default.

I did it in this blog because I prefer it this way.




I am afraid you can't do anything about these defaults in the Blogger Theme Designer. You can however make some changes to the HTML of the template and have your blog archive and labels expanded when the page loads, after all.

It is a good practice to back the template up before making any changes to it. If something goes wrong, you can always roll back to the original version.

So let's open the template HTML editor.

Open the template HTML editor (Theme / Edit HTML)
  1.  From your blog's dashboard, click "Theme", then "Edit HTML" to open the template HTML editor.
  2. In the editor, click "Jump to widget" and select "BlogArchive1" in the drop-down menu.
Jump to the Blog Archive widget (Jump to widget / BlogArchive1)

Thus, you'll "jump" to the markup of the Blog Archive widget in the HTML.

Locate the main element in the Blog Archive widget's markup
Here:
  1. Locate the element <b:widget id="BlogArchive1" ...>.
  2. Below, locate the element <b:includable id="main" var="this">.
  3. Click the ellipsis (...) right after this element to expand it and see its child elements.
  4. Below, locate the element that reads <b:attr cond='data:view.isArchive' name='open' value='open'/>.
Locate cond='data:view.isArchive' in the Blog Archive widget's markup

In this element there is a condition cond='data:view.isArchive' that makes the widget "open", that is, expanded.

I haven't yet figured out when this condition is met. But it definitely looks like this condition is not met when the page loads.

So I suggest removing this condition. (If something goes wrong, redo the above steps and reintroduce this condition in the very place where you have just removed it.)

So:
  1. Delete cond='data:view.isArchive' from this element.
  2. Save your changes by clicking "Save theme".
Remove cond='data:view.isArchive' in the Blog Archive widget's markup

And now, the "Labels" - just repeat the above steps but jump to "Label1", and then locate and remove its condition. Here it will read cond='data:view.isLabelSearch'.

Locate cond='data:view.isLabelSearch' in the Labels widget's markup
  1. In the editor, click "Jump to widget" and select "Label1" in the drop-down menu.
  2. Locate the element <b:widget id="Label1" ...>.
  3. Below, locate the element <b:includable id="main" var="this">.
  4. Click the ellipsis (...) right after this element to expand it and see its child elements.
  5. Below, locate the element that reads <b:attr cond='data:view.isLabelSearch' name='open' value='open'/>.
  6. Delete cond='data:view.isLabelSearch' from this element.
  7. Save your changes by clicking "Save theme".
Remove cond='data:view.isLabelSearch' in the Labels widget's markup

When you reload the page with the sidebar, or open the sidebar after reloading the page, you'll see your blog archive and labels expanded.

Widgets on the sidebar expanded by default in Google Blogger

In my blog it looks like this:

Widgets on the sidebar expanded by default in my blog 2 Read 4 Free

(You've probably noticed that the width of the sidebar here is greater. It is even greater than the allowed maximum here. I'll discuss how to do it in one of the following posts.)

Comments

  1. Hello!

    Any ideas on how to access the right side of the screen on this contempo these. The layout page only allows widgets on the left sidebar or central page, but the right side of my blog is empty and I'd like to ad some html there

    ReplyDelete

Post a Comment

Popular posts from this blog

How to reduce the height of the top image from the Contempo theme

Contempo theme? Customized!