This blog uses the new "Blogger in Draft" template, Picture Window. I've also played with the Awesome Inc and Watermark templates. Unlike Minima, and other older templates, the new templates use positioning to create a two-column or three-column layout. Conditionally hiding the sidebar on a Blogger Page requires a different approach.
If it worked, the simplest method would be to conditionally modify <b:variable> declarations at the beginning of the <b:template-skin> section. I tried several variations of doing this, without much success. However, it is possible to hide the sidebar on a specific Page by using a Blogger conditional that overrides existing CSS for column widths.
The overriding CSS can be placed after the closing </b:template-skin> tag and above the closing </head> tag. Alternatively, add it as an internal style sheet in a particular Blogger Page, before other content. I have tested both methods in the Picture Window and Awesome Inc templates.
If your template is slightly different, or uses a different number of columns, you'll need to adjust the CSS posted below to work with your layout. The concept remains the same: Hide one or more sidebars and make the content column wider, so that it fills the freed space.
Two-column Awesome Inc or Watermark template
Just after the closing </b:template-skin> tag, add the following CSS, which will override existing styles and suppress the right sidebar when the URL matches the Blogger conditional. To make it easier, copy and paste the styles to be changed from the existing CSS code in <b:template-skin>. Replace the url in the sample code with the url of your own page:
<b:if cond='data:blog.url == "http://blog.blogspot.com/p/page.html"'>
<style type='text/css'>
.main-inner .columns {
padding-right: 0;
}
.main-inner .fauxcolumn-center-outer {
right: 0;
_width: expression(this.parentNode.offsetWidth -
parseInt("$(main.column.left.width)") + 'px');
}
.main-inner .fauxcolumn-right-outer {
width: 0px;
}
.main-inner .column-right-outer {
width: 0px;
margin-right: 0;
display: none;
}
</style>
</b:if>
In the style for_width, above, I omitted:
- ParseInt("$(main.column.right.width"))
because we are making the right sidebar 0px wide, and there's no need to subtract 0 from the width of the main column. If you don't have a left column,left.widthis also 0px wide, and you can shorten the expression to:
_width: expression(this.parentNode.offsetWidth + 'px');
This code is in use on my sandbox test blog, with the Watermark template. I also used it there with Awesome Inc. I think it would also work with the other templates, using a simple two-column layout.
If you don't want to mess with the template, add the following internal style sheet to the Blogger Page in which the sidebar should not display. I recommend removing line breaks in the style sheet so that it's all on one line, particularly if your settings allow Blogger to add break tags in the post editor:
<style type="text/css">
.main-inner .columns {padding-right: 0;}
.main-inner .fauxcolumn-center-outer {right: 0;
_width: expression(this.parentNode.offsetWidth -
parseInt("$(main.column.left.width)") + 'px');}
.main-inner .fauxcolumn-right-outer {width: 0px;}
.main-inner .column-right-outer {width: 0px; margin-right: 0;
display: none;}
</style>
Picture Window template
I am using the following overriding CSS on this blog, which combines sidebars on the right. The "double" sidebar uses 390px of layout width. By hiding the outermost sidebar, #sidebar-right-2-2, it requires only 220px on my Real Tea page. To make modification easier, copy and paste the styles to be changed from the existing CSS code in <b:template-skin> to the new <style> tag. Remember to change the url to match your blog and special page:
<b:if cond='data:blog.url == "http://blog.blogspot.com/p/page.html"'>
<style type='text/css'>
.main-inner .columns {padding-right: 220px;}
.main-inner .fauxcolumn-center-outer {right: 220px;}
.main-inner .fauxcolumn-right-outer {width: 220px;}
.main-inner .column-right-outer {margin-right: -220px; width: 220px;}
.main-inner .column-right-inner table.section-columns td
{display: none;}
.main-inner .column-right-inner table.section-columns td.first
{display: inline; width: 100%;}
#sidebar-right-2-2 {display: none;}
</style>
</b:if>
Again, if you don't want to edit the template, add an internal style sheet to the Page in which the sidebar should not display. I recommend removing line breaks in the style sheet so that it's all on one line:
<style type="text/css">
.main-inner .columns {padding-right: 220px;}
.main-inner .fauxcolumn-center-outer {right: 220px;}
.main-inner .fauxcolumn-right-outer {width: 220px;}
.main-inner .column-right-outer {margin-right: -220px; width: 220px;}
.main-inner .column-right-inner table.section-columns td
{display: none;}
.main-inner .column-right-inner table.section-columns td.first
{display: inline; width: 100%;}
#sidebar-right-2-2 {display: none;}
</style>
Test, test, test
Backup your template before making changes to it. Here, we are simply adding a short code block to the template. To "roll back" delete the added code. It's easiest to test an internal style sheet in the Page you need to change first. If all is well, then you can move the CSS to the template itself. To avoid errors, paste the styles to be modified in your new style sheet, and then adjust the relevant pixel values.
Caution: Adding an internal style sheet to a post may not be such a great idea because it really doesn't belong in your RSS or Atom feed.
I hope this gives you some ideas on how to hide a sidebar in your beautiful new Blogger template for a special page or two!
26 comments:
Hey Araby, and that came before the morning coffee. I wonder what you can do after a couple of danish pastries added to it.
However, it didn't work. But I am sure it's my fault as I am completely illiterate.
I'd rather not mess with the template, if possible. So I just copied your "internal style sheet" and pasted it into the post of the page in which I want to hide the sidebar. The post also contains a HTML code for embedding a player. I don't know what you mean by "compress the style sheet so that it's all in one line" I just got rid of the spaces in between the lines of your code. Nothing happened.
I wouldn't go for the single column layout template as I need the sidebar everywhere else but in the three (at the moment) pages where I am planning on placing a large player.
I have a 1000 questions for you that I will eventually fire one by one if you allow me to. But please, just out of curiosity, would you mind giving a look at this site and tell me what would I need in terms of knowledge, time and probably money to organise my video blog like that (or perhaps like Bloggingheads or VloggerHeads). Thumbnails with description -> click -> video plays in central player. I have unsuccessfully googled for days to find a practical solution that would have allowed me a similar layout.
Regards and sorry for too many words
There was a missing quotation mark in the style tag (now fixed). Sorry about that! I've temporarily removed the code block from my template and used the same CSS in an internal style sheet on my sandbox blog (link is in post), sample store page. I removed line breaks inside the style sheet. You can view source to see it.
If your sidebar is on the left, the styles would need to be reversed.
Sidebar still there. I can see it working in your sandbox though.
I tried both the code in this post and the code without line breaks in your sandbox template. I did a copy and paste to post page. Same outcome: main widens to push right sidebar further right.
BNet appears to be using a custom Flash player. They're using the FlashVars param to pass a variable named paramsURI to their script. Notice that the value of paramsURI for the first clip in the collection (Is Email Dead?) is 2422-13950_23-360980.xml, which matches the URL of the clip page: 2422-13950_23-360980.html. Other than that, I don't do enough Flash to really help you.
If you have a div on that Page with a specified width of 100%, make it a specific pixel width (that still fits in content column). To the style for .main-inner .column-right-outer add display:none;
If that doesn't work, you could add display:none to a new style for .column-right-inner.
Sidebar showing stubbornness. Still not working.
I don't know what a div is. Width of entire blog is 930 px. Width of sidebar is 390 px.
I tried adding display:none; and .display:none; too.
I copied style and pasted underneath. So I have two styles now (?). In second style I replaced .column-right-outer display:none; with .column-right-inner display:none;
Feeling dizzy but intrigued by the code forest.
No, that won't work. It's a bit mixed up. What is the URL of the page you are trying to fix?
A div, like a paragraph, is a block element in your HTML code. If a width of 100% is specified in the div tag, the width should be changed to a pixel width less than the width of the actual content. The text in your content column is not really 930px wide because of padding, borders, and margins on various things in your layout.
Did you fix the missing quotation mark (in the style tag) in your copy of the code after I re-posted?
The property display:none; is added inside the curly brackets following the .classname or element that gets the style. What you added will not work and may break the style sheet. You can put several styles for a single .classname inside the curly brackets, but each one must end with a semi-colon to separate it from the others.
Araby, it works!
I added display:none into the last curly brackets of the style code above like this: .main-inner .column-right-outer {display:none; width: 0px;margin-right: 0;} and it worked.
It's fantastic to be able to modify a single page with a short piece of code from the post itself without messing with the template. I wasn't even sure it was possible before finding your blog.
I am keeping my blog private while I am working on the layout. I would gladly grant you permission to visit but I couldn't find your email?
Thank you so much for the valuable help you kindly provided! I really appreciate. I am afraid I shall pester you again soon with more questions... in the meantime happy easter.
Yes, that's perfect! Thanks for letting me know you got it working! And Happy Easter to you, too.
Hi Araby,
I didn't look much around but I think you are leading the way to hacks the new blogger in draft.
An easy one which I guess you can sort out by the time the morning coffee gets ready.
Custom Favicon! Yours seems to be working quite well.
Before switching to Awesome Inc I was experimenting with Minima Black and tried placing this code in the template just before {/head}.
{link href='MY-FAVICON-URL' rel='shortcut icon'/}
{link href='M-FAVICON-URL' rel='icon'/}
{} = <>
It worked in Safari but didn't work in Firefox.
I did the same to the Awesome Inc template with the opposite result: not working in Safari, working in Firefox. Obviously, I would like my Favicon to show in any browser, IE too.
I have a 16x16 and 32x32 .png hosted by Photobucket and a .ico hosted by HostanyPic.
What do you think?
Many Thanks!
I am using a 16x16 .png file for the favicon on this site, with a link in the template head tag that follows this pattern:
<link href='http://servername.com/imagefolder/filename.png' rel='shortcut icon' type='image/ico'/>
Great, it works in both Safari e Firefox!
Is there an easy way of showing a widget in a static page only?
I would like to show a list of names with links sorted alphabetically that I can edit from the Configure List widget.
Thanks!
Not so easy, but can be done. I don't think I can explain in a comment without the code, so I'm going to put brief instructions on greenesandbox.blogspot.com, in a moment. Only the About page has a linklist.
I saw the code, I am a bit confused. I intend to show the list of names in the main body of the static page, not in the sidebar. I was hoping in a paste-code-in-post-solution. The idea is to title a page "Guests" and list all names with a link to their videos.
The ID of the widget I thought of using is TextList1. I can eventually replace your LinkList1 with that. Where exactly should I place your code in my template?
Sorry if I got something wrong. I am doing my best but HTML is still a mystery to me.
Ah, I assumed you meant to add the link list in it's usual sidebar location. You do not need a widget to create a list of Guest names that link to videos. A simple bulleted list that you add and edit in the Page will do exactly the same thing.
To add one to a Page, click the Bullet List icon (third from the right) in Compose. Type the Guest's name. Highlight the name with your mouse and click the Link icon. Paste the video link and click OK. To add a new bullet for the next Guest, press Enter. That's all there is to it! See the (temporary) sandbox Guests page for an example.
If you prefer a list without bullets, switch to the HTML tab and add a style to the ul tag: <ul style='list-style: none;'>
Yes, that sounds easy enough. The widget would have spared the pain of sorting the list manually.
Anyway, it seems that I cannot switch to Compose in the page post (I can in normal post), it is gray-out. Any idea why?
The problem with the Compose tab on Pages is a bug. There have been many complaints on the Blogger Forum about it.
You cannot add a template gadget to an individual Page, as far as I know. However, you can add it in the main section above Blog Posts, if you still want to do this in order to use the sort function. The procedure is very similar to that for adding it in a sidebar. I've posted instructions and an example on my sandbox blog.
Yes, it works beautifully!
Also, I hid the page title. Only thing is, the area that contained the page title is still there sitting under the guest list and making no sense. Any way of getting rid of it? Or maybe putting it to some use like accommodating a (image) link to top of page?
Btw, the compose tab in page post is now miraculously clickable.
Great! Try adding a style to the HTML element in your page to move it up into the space. If the first element is an h4, you would make it:
<h4 style='margin-top: -14px'>
I think using the page body as a place for a link and/or image link is a good idea. You can't get rid of it altogether.
I am afraid I am not getting this. I should place the style in the post of the guests page? I don't understand what the first element is. In the post page I see an h3. I tried your style as h3 and as h4 but nothing happened.
Anyway, the page body at the bottom of the guests list can be useful. Apart from the top of page link (which would be nice to show at the bottom of each page), I may want to place a contact form for potential guests who would like to join the vloganza or just allow comments or anything else.
So new question is: how to generate an image go to top of page button in each and every page of vlog?
Kudos and bows to you!
The first block element in the body of your Page might be a <p> or a <div>. Mine is an <h4>. A block element, unlike an inline element (such as a span), starts on a new line and is followed by a line break. It can have vertical margins, so a negative top margin of 14px will move it up on the page.
To make a link to the top of each page, add id='top' right after the opening body tag, or as close to it as possible:
<body class='loading'>
<div class='body-fauxcolumns' id='top'>
To create a link that goes to the top of the page:
<a href='#top'>Return to top</a>
To clarify, add id='top' to a block element as close to the body tag as possible. When a visitor clicks the link to #top, the page will scroll to the location of id='top'
Thanks so much for this info for the new templates! I used the internal page code and had no problems. I am using one of the new simple templates with sidebar on right and left. I had success with updating code to remove left sidebar as well but think I'll leave it for the time being since it is my only source of color. nebizrecovery.blogspot
Thanks for letting me know that it worked with your new template! Your blog looks great, a nice clean look appropriate for its purpose.
This is great. Thanks.
I was having problems with my sidebar in my static pages on my site which is at www.srj-news.blogspot.com. I could not use the new tempelates I wanted to use as the sidebar covered some of my stuff. With this I can put the Simple templete on.
Thanks Again
Your store looks perfect! Some great products for Earth Day. Love the backpack with solar generator!
Post a Comment