Showing posts with label Customizations. Show all posts
Showing posts with label Customizations. Show all posts

Thursday, June 17, 2010

Template Designer is Live

The Template Designer which I blogged about a couple of months ago when it was in beta, has gone live!

This brings in a powerful WYSIWYG editor to tweak your templates in many beautiful ways. The features include the ability to pick from professionally designed templates, option to select professional images as background images, ability to select many different layouts such as two-column, three-column etc in a snap and much more. The Template Designer is truly a wonder tool for the non-technical bloggers who were afraid of meddling around with the HTML, CSS etc to customize their templates.

With the introduction of this new remarkable feature, Blogger has revised the buttons on the admin console as well. The former Layout button has gone out and a new button called Design has taken its place. The sub-menu for this section has also been revised with the old Fonts and Colors and Pick New Template buttons being replaced with a single Template Designer button. (see figure below)

The Edit HTML option still remains allowing the more technically inclined bloggers to dig deep. However, the template structure seems to have gone through drastic changes in order to support the new Template Designer. Don't worry, Blogger will take care of migrating your existing template to this new format if and when you modify your template using this option. One thing to note, however, is that you will lose any existing customizations on top of the current default templates.

See the official Blogger Buzz announcement for more details.

Sunday, April 4, 2010

The Template Designer

Blogger has developed another very exciting feature called the Template Designer. With it, you can create custom template designs using an extremely user-friendly interface without having to worry about meddling with HTML code! Yes, that's right, you don't have to go through the Layout -> Edit HTML interface to get another sidebar to your template, or to add a nice background image to your blog or to do many more template tweaks.

This feature is still not released formerly and is now in testing stage in Blogger in Draft. If you log in to draft.blogger.com, and go to the Layout section of your blog, you will see a new sub section called the Template Designer. (see figure below)


From that interface, you get to choose from a set of expert designed templates, manipulate the column layouts with a snap, apply many different background images and also customize the fonts and colors. You get a real-time preview as well, making it easier to experiment.

Go on and try it at Blogger in Draft and I'm sure you will love it!

Note:
Even if you have applied any customizations such as three-columns or wider-blogs from The Blogger Guide tutorials, the Template Designer will still work. It will recognize that the template is customized, but still its changes will work.

Saturday, November 28, 2009

Minima : Hanging Sidebar on the Left

This article presents an interesting modification to give you a non-conventional three column layout. The idea is to add a second sidebar to a default Minima template offered by Blogger, to make it appear as hanging by the side of the blog. The figure below has a preview of the finished modification and visit the Hanging Sidebar Demo blog for an online demo.

The following steps are tested on a default 2 column Minima template but this conversion should also work on Minima Black, Minima Blue and Minima Ochre templates.

1) Add a new CSS id selector for the 2nd sidebar wrapper.

  • Go to Layout -> Edit HTML
  • Locate the #sidebar-wrapper section (Do a Find using your browser)
  • Copy that full section and paste below the existing sidebar section (it doesn't have to be below) and rename it to #left-sidebar-wrapper
  • Change the float: $endSide to float:$startSide of this newly copied section (See the code snippet below)
#sidebar-wrapper {
width: 220px;
float: $endSide;
word-wrap: break-word; /* fix for ... IE */
overflow: hidden; /* fix for long ... float */
}

#left-sidebar-wrapper {
width: 220px;
float: $startSide;
word-wrap: break-word; /* fix for ... in IE */
overflow: hidden; /* fix for long ... float */
}

2) Introduce a new div element, as a child of the content-wrapper, to be the placeholder for the 2nd sidebar
  • Locate the <div id='main-wrapper'> element.
  • Copy the code shown in red, above that section (this has to be above)
<div id='crosscol-wrapper' style='text-align:center'>
<b:section class='crosscol' id='crosscol' showaddelement='no'/>
</div>

<div id='left-sidebar-wrapper'>
<b:section class='sidebar' id='sidebar-two' preferred='yes'>
</b:section>
</div>

<div id='main-wrapper'>
<b:section class='main' id='main' showaddelement='no'>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>
</b:section>
</div>

3) Add a new CSS section for an outer header wrapper which will encompass the existing header wrapper
  • Add the following code below the existing #header-wrapper section
#outer-header-wrapper {
width:880px;
margin:0 auto 10px;
}

4) Add a div section as the placeholder for this outer header wrapper
  • Locate the section <div id='header-wrapper'>
  • Copy the code shown in red, above and below that section
<div id='outer-header-wrapper'>
<div id='header-wrapper'>
<b:section class='header' ... >
<b:widget id='Header1' .../>
</b:section>
</div>
<div class='clear'>&#164;</div>
</div>


5) Adjust the other wrappers to accommodate the new sidebar
  • Locate the CSS sections called #outer-wrapper, #header-wrapper and #footer
  • Do the modifications/additions highlighted in red
#outer-wrapper {
width: 880px;
margin: 0 auto;
...
}

#header-wrapper {
width: 664px;
float:$endSide;
margin: 0 auto 10px;
...
}

#footer {
width: 664px;
clear: both;
margin: 0 auto;
...
}

6) Do necessary adjustments to margins, padding etc
  • Locate the #main-wrapper section
  • Insert a left margin of 12 pixels.
#main-wrapper {
width: 410px;
margin-left:12px;

float: $startSide;
...
}

7) Adjust the max width of the header description to center it in the new adjusted header
  • Locate the #header .description section
  • Change the max-width property to 644 pixels.
#header .description {
...
padding:0 20px 15px;
max-width:644px;
...
}

8) Modify the CSS rules for the wire frame layouts editor.
  • Locate the end of the skin denoted by "]]>"
  • Add the following code above that line.
/** Page structure tweaks for layout editor wireframe */

body#layout #outer-wrapper {
padding-top: 0;
width:720px;
}
body#layout #header-wrapper,
body#layout #content-wrapper,
body#layout #footer {
padding: 0;
width:720px;
}

body#layout #main-wrapper {
width:400px;
}

body#layout #sidebar-wrapper,
body#layout #left-sidebar-wrapper {
width:150px;
}

]]></b:skin>

Save the template. Switch to Page Elements view and move some widgets on to the left sidebar. Then view your blog to see the hanging sidebar in full swing!

(Note: This modification was applied to a default Minima template and was tested on Firefox 3, IE 8 and Chrome 3)

Saturday, October 24, 2009

HOWTO: Customize Post Page Labels

This is an answer to a question I got from a reader. The question had two things; firstly "How do I change the 'comments' label to something like 'reviews'?" and secondly "How can I change the label 'Posted by' to something different?"

There's something common about both of these questions. They both are Post Page labels (the word labels is used to mean string literals and not the labels used to categorize posts). Customizing these strings to something of your own is pretty simple. Just open the Blog widgets configuration dialog and change the strings as you like.

The illustration below is about how you can change the default comments label to "reactions".

Wednesday, August 5, 2009

A Better Read More Option

In a previous post I presented a simple technique to add a Read More option to hide a desired portion of long blog posts. But that method has a drawback because it shows the "Read More" link even for the posts that do not have hidden parts.

Here's an improved version of that technique which shows the Read More link only if you have decided to hide part of a post. [Note that the "Read More" link will be displayed only on the blog home page and archive (i.e. label) pages]

1) Go to Layout -> Edit HTML and click the ‘Expand Widget Templates’ check-box.

2) Locate the </head> tag and copy the code shown in red in the following snippet, above that tag.

]]></b:skin>
<b:if cond='data:blog.pageType == "item"'>
<style>span.fullpost {display:inline;}</style>
<script>function tbgHideReadMores() {}</script>
<b:else/>
<style>span.fullpost {display:none;}</style>
<script>
function tbgHideReadMores() {
var els = document.getElementsByTagName(&#39;*&#39;);
for (i = 0; i &lt; els.length; i++) {
if ((els[i].className == &#39;post-body&#39;) || (els[i].className == &#39;post-body entry-content&#39;)) {
tbgHideReadMore(els[i])
}
}
}

function tbgHideReadMore(post) {
var spans = post.getElementsByTagName(&#39;span&#39;);
var found = 0;
for (var i = 0; i &lt; spans.length; i++) {
if (spans[i].className == &quot;fullpost&quot;) {
spans[i].style.display = &#39;none&#39;;
found = 1;
}
}

var lnks = post.getElementsByTagName(&#39;a&#39;);
for (var i = 0; i &lt; lnks.length; i++) {
if ((lnks[i].innerHTML == &quot;Read More&quot;) &amp;&amp; (found == 0)){
lnks[i].style.display = &#39;none&#39;;
}
}
}
</script>
</b:if>

</head>

3) Locate the <body> tag and modify it as shown below.

<body onload='tbgHideReadMores()'>

4) Locate the <data:post.body/> element and add the code shown in red below.

<div class='post-body entry-content'>
<p><data:post.body/>
<b:if cond='data:blog.pageType != "item"'><br/>
<a expr:href='data:post.url'>Read More</a>
</b:if>

</p>

5) Then for each post that you want to display a summary, you have to add the following piece of code enclosing the part that you want to hide. (Do this from the Edit Html tab of the post editor)

This is a sample long post. Only these two lines are visible on the homepage.

<span class="fullpost">This sentence, which is enclosed inside the HTML code
shown in red, will be displayed only when a visitor clicks on the Read More
link.</span>


Notes:
  • Instead of "Read More", if you want some other phrase such as "Continue...", then you have to put that exact string in the places in which "Read More" appears in steps (2) and (4).
  • The unnecessary Read More links get hidden only after the page is fully loaded. So you might see them initially, until the home page gets fully loaded in the browser.

Sunday, July 19, 2009

Aligning the Header Image

In a previous post I talked about how the Blogger’s header image gets resized depending on the size of the image, the available space in the header and the configuration of the header widget. In this one, I will answer another question I get so often from my readers; “How can I center the header image?" This handy tip will help you not only to center align the header image, but also to right align it, if required.

First add the header image as you would normally do it. Then, to center Blogger’s header image, simply add the following CSS snippet to your template’s skin. (Read this to learn more about the Blogger template structure)

For placement “Behind title and description” add:

#header-inner {
margin-left: auto;
margin-right: auto;
}

For placement “Instead of title and description” add:

#header-inner img {
margin-left: auto;
margin-right: auto;
}

You can add it anywhere inside the skin. But, to keep all header related styles close apart, add it after a style such as the #header-wrapper or #header.

To right align the header image, simply remove the “margin-right: auto;” statement from the above block.

This trick has been tested on Denim, Denim Stretch, Rounders and Scribe templates. (Minima has it by default). But it should work on all other default Blogger templates. If it doesn’t work on a particular template, please let me know.

Sunday, July 12, 2009

Variable for File Host Location

This post explains how you can add a template variable to define a third party file host location. The file host defined here will be used to host all the custom images provided free with The Blogger Guide's various popular HOWTOs such as the three column and wider two column template conversions.

Go to Layout -> Edit HTML mode and add the variable as described below.

The template variable we add here is of type automatic. To incorporate it, simply add the code shown in red below, right to the end of your template's Variable declaration section. (Usually, the last variable on a default Blogger template is the endSide variable)

<Variable name="endSide" description="End side in blog language"
type="automatic" default="right" value="right">
<Variable name="imageHost" description="Image Host Location"
type="automatic" default="http://idssl.fileave.com/tbg"
value="http://idssl.fileave.com/tbg">


*/

To learn more about Blogger template variables, read the article shown in Related Posts below.

Saturday, July 4, 2009

Screen Resolution and Template Size

What is the best screen resolution to target a web site template design? This is an important question for those who are interested in designing templates and also who customize templates. That is because the screen resolution is a determining factor when it comes to what your website’s visitors see and don’t see.

Firstly, what is screen resolution? In simple terms, it is the number of pixels (or dots) that make up your entire screen. It is usually expressed as the number of pixels horizontal in to number of pixels vertical. For example, a screen resolution of 1024 x 768 means that a screen can display 1024 pixels across and 768 pixels down. The total number of dots that make up your entire monitor is the multiplication of those two numbers.

It is difficult to pick one right resolution to target your template’s size. Monitors used by Internet users around the world range in resolutions from 640 x 480 (very rare now) to 1600 x 1200 or higher. Further, as technology advances and hardware becomes cheaper, more and more people will move in to high resolution monitors. According to w3schools.com, in January 2009, 96% of its visitors had resolutions of 1024 x 768 or higher. The flip side is that 4% still has 800 x 600 resolutions.

Some time ago, websites were designed targeting an 800 x 600 resolution. But now that the share of that resolution has gone down significantly, the current practice is to optimize a website design for 1024 x 768, a fact even recommended by Jakob Nielsen, the web usability guru, back in 2006.

So what’s the use of this knowledge for the regular blogger? Well, if you want to use a custom third party template or go for a modification of the existing template by adding a new column or increasing its width, check whether the resulting template fits within the 1024 x 768 resolution. You should worry more about the horizontal resolution than the vertical one. Generally, if your custom or modified template has a width of less than 1000 pixels then you can safely assume that a very large percentage of your readers can see the entire width your site without having to scroll horizontally.

Sunday, April 26, 2009

Header Image in Widened Blogs

This is a question I get from time to time from the people who have widened their blog by following one of the three column conversion or wider post column guides. This post is an answer to that question.

The header image is uploaded via the Header element in the Layouts -> Page Elements section.


The available size for this image depends on the size of you header. For example, in the Minima template, it is the width of the #header-wrapper CSS selector. If the image you upload is smaller than this maximum available size, Blogger will upload it as it is. But if the image you upload has a higher width than the available size, Blogger's action will depend on whether you've selected the Shrink to fit option in the Configure Header dialog box. If that option is selected, the width of the image you upload will be resized to the maximum possible size. (The height of the image will also be adjusted to the same scale to avoid distortion. But the reference dimension is the width). If Shrink to fit is not selected, the image will be uploaded as it is despite it being bigger.

When you customize your blog either by adding a third column or by expanding the size of the post area, the header size will also be widened to match the new blog width. Therefore, you will have to re-upload the header image. If the current header image is smaller than the new blog width after the expansion, then you have to widen the header image as well. For that you need to use some image processing software such as Photoshop. If, however, the image you uploaded had an actual width that is bigger than the new expanded header size, a simple re-uploading will do.

Tuesday, February 24, 2009

Wider Header for Dots Template

The Dots (or the Dots Dark) template, which is a default Blogger template, has its Header widget inside the left sidebar. Since the Header widget carries the title and the sub title (or description) of a Blogger blog, this arrangement brings about a somewhat congested appearance. This tutorial will illustrate how this Header widget can be moved to the more usual, across-the-top placement.

First let’s take a look at the Before and After views of what we are going to do.

Before:


After:


As you can see, the After view has the blog title running across the blog, instead of being stuck at the left sidebar.

(Note: Please backup your template before trying out this modification)

Go to the Layout -> Edit HTML mode and first make sure that the ‘Expand Widget Templates’ option is NOT selected. Then apply the following steps.

1) Delete the background property in the #outer-wrapper CSS selector.

#outer-wrapper {
background:url("http://www.blogblog.com/dots/bg_3dots.gif") no-repeat 250px 50px;

}

2) Delete the existing line “display:none;” in the #header-wrapper and add the following rules.

#header-wrapper {
background:url("http://www.blogblog.com/dots/bg_3dots.gif") no-repeat bottom right;
width:700px;
height:90px;
margin:0 auto 10px;
}

For the Dark Dots template, change the URL as follows.

background:url("http://www.blogblog.com/dots_dark/bg_3dots.gif") no-repeat bottom right;

3) Change the first padding value in the #main-wrapper to 10 px from 100 px

#main-wrapper {
width:450px;
float:$endSide;
padding:10px 0 20px;

}

4) Change the first padding value of #sidebar to 10 px from 40 px
#sidebar {
...
padding:10px 10px 15px;

}

5) Delete the existing <b:section> element for the header contained inside the sidebar-wrapper.

<div id='main-wrapper'>
<b:section class='main' id='main' showaddelement='no'>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>
</b:section>
</div>

<div id='sidebar-wrapper'>
<b:section class='sidebar' id='header' maxwidgets='1'>
<b:widget id='Header1' locked='true' title='Your Blog Title (Header)' type='Header'/>
</b:section>


<b:section class='sidebar' id='sidebar' preferred='yes'>


6) Copy the code shown below in red, in between the outer-wrapper and the crosscol-wrapper, to get the new header. (You will have to re-type your blog title after copying this code)

<div id='content-wrapper'>
<div id='header-wrapper'>
<b:section class='sidebar' id='header' maxwidgets='1'>
<b:widget id='Header1' locked='true' title='Your Blog Title (Header)' type='Header'/>
</b:section>
</div>

<div id='crosscol-wrapper' style='text-align:center'>
<b:section class='crosscol' id='crosscol' showaddelement='no'/>
</div>

Save your template and now you should have your header going across the top of your blog.

Thursday, January 29, 2009

Blogger HOWTOs

Given below is a categorized list of HOWTOs available on The Blogger Guide.

Template Customizations

Site Traffic
Blog Promotion
Miscellaneous
Last Updated: 2009 Jan 29

Saturday, January 3, 2009

Adding a Simple Navigation Bar

The term navigation bar is typically used to refer to an array of hyperlinks allowing visitors to quickly move around in a web site. Navigation bars can be in horizontal or vertical arrangements. This article will explain how you can add a simple, vertical navigation bar at the top of your Blogger blog. (This is called ‘simple’ because it is text-based and will not appear as a tabbed array of buttons)

This method is so simple that all you need is a simple Text Widget placed at the Header section of the template. (See this article to learn how to add Blogger gadgets to the Header section)

For example, consider a navigation bar such as the one shown in the figure below.


For the purpose of demonstration, I will only use the first two links in that bar. To add those two links, this is the HTML code you need. (IMPORTANT: All of this must be in a single line, and the line breaks are added only for clarity)

<a href="http://bguide.blogspot.com/">Home</a> |
<a href="http://bguide.blogspot.com/2008/02/three-column-templates-explained.html">3 Columns Explained</a>

It’s a mere sequence of URLs separated by a pipe ( | ) character. The separator can be any character, but the pipe is the best fit there. The general form of a URL is as follows.

<a href="URL">Link Text</a>

The Link Text is the portion of text displayed on the browser. The URL is the reference (or web address) of the actual page to link to. The following snippet shows a sample HTML code to create a navigation bar with some hypothetical links from a Blogger blog.

<a href="http://myblog.blogspot.com">Home</a> |
<a href="http://myblog.blogspot.com/YYYY/MM/post-one.html">Post One</a> |
<a href="http://myblog.blogspot.com/YYYY/MM/post-two.html">Post Two</a> |
<a href="mailto:myemail@example.com">Contact Me</a>

As stated earlier, all of the above code must be in a single line. Line breaks are added for clarity only.

Adding this alone using a text widget would serve the purpose, but to get the hovering effect to highlight the links when mouse is moved over, we need a little bit of CSS. Given below is a CSS class selector called mynav limited to the scope of div elements. The properties highlighted in red should be adjusted to match the colors and layout of a given blog.

div.mynav
{
margin : 0 14px .1em;
font-size : 12px;
font-weight : bold;
}

div.mynav a
{
text-decoration : none;
}

div.mynav a:link, div.mynav a:visited,
div.mynav a:active
{
color: #ffffff;
}

div.mynav a:hover
{
color: #eebf9f;
}

Explaining the above set of CSS rules is beyond the scope of this article. If you need to use it however, just copy the above code snippet and install it in your template as illustrated in the article How to Add a Custom CSS to Blogger. Once the CSS style is installed, we need to apply that style to our navigation bar code. That is done by enclosing that entire code in a <div> element with the class mynav. The following code snippet shows the final result.

<div class="mynav">
<a href="http://bguide.blogspot.com/">Home</a> |
<a href="http://bguide.blogspot.com/2008/02/three-column-templates-explained.html">3 Columns Explained</a>
</div>

All right, that’s it. Formulate all the code you want in your navigation bar and install it using a text widget in to your blog Header.

Wednesday, October 1, 2008

HOWTO: Add an image beside a URL

In this article, we will learn a simple technique to display an image by the side of a URL. This method uses a simple CSS class to dress up the URL.

First, we need to select an image to be displayed. In this example, I'm using a 14x14 pixel image hosted on this blog's companion site. (Note: The selected image must be hosted online)

Then, we add a simple CSS rule, such as the one below, to the blog's skin.

a.image {
padding-right:16px;
background:url(http://thebloggerguide.googlepages.com/icon_ext_window.png) no-repeat 100% 50%;
}

In the above code, the a.image selector is called, in CSS jargon, a class selector. What that means is that any anchor element (i.e. <a>) that has the class property set to image will be modified according to the rules defined in that selector. In this instance, the first rule tells the browser to insert some space (i.e. padding) to the right of the URL and the second rule inserts a background image to be displayed in that space.

The following screenshot illustrates how this CSS code can be added by going to Layout -> Edit HTML.


Once this code is added to the blog skin, it is available to be used from within blog posts.

The last step is to attach this CSS rule to the URL that needs to be modified. All you need to do is to add class="image" attribute to that URL.

<a href="some URL" class="image">The Link Text</a>

For example, the following HTML:

<a href="http://thebloggerguide.googlepages.com" class="image">The Blogger Guide Web Site</a>

will be displayed as follows.

The Blogger Guide Web Site

That's it. Try it yourself and let me know how it goes.

PS:
This is the first post after a long silence of about 3 months. Though new content was not added, I was responding to my readers' queries. Hope to get back to more frequent posting again. Many thanks to all the readers out there!

Friday, May 30, 2008

Scribe with a wider post area

Article Series: Wider 2 Column Templates - Step by Step Guides

Here are the steps to increase the width of the main post area of the Scribe template by a desired amount. This is useful if you frequently upload images/embed videos etc that are wider than the default width of the post column.

1) Decide the amount of pixels by which you want to increase the width of the post area. In this article, I will be expanding it by 200 pixels. (In fact, you can pick an arbitrary size and experiment to see if that is enough for you)

2) Increase the width of the post area

  • Go to Layout -> Edit HTML
  • Locate the #main CSS selector (Do a Find using your browser)
  • Increase its width property by adding the amount of pixels picked in step (1). Here we change it to 630 by adding 200 to the default width of 430 pixels

#main {
width:630px;
float:$endSide;
...
}

3) Increase the width of the other wrappers to accommodate the expanded main wrapper.
  • Locate the following CSS sections
  • Change their width property to 900 pixels

#outer-wrapper {
...
width:900px;
...
}

#main-top {
width:900px;
...
}

#main-bot {
width:900px;
...
}

#wrap2 {
width:900px;
...
}

4) Replace the other background images with expanded ones as necessary.
  • Add a template variable to define the image host location as explained here. (This step will open up in a separate window. Return to the next bullet point after that)
  • Locate the following CSS selectors.
  • Replace the URLs of the images to the ones shown in red below.

#main-top {
width:900px;
height:49px;
background:#FFF3DB url("$imageHost/scribe_bg_paper_top_w.jpg") no-repeat top left;
...
}

#main-bot {
width:900px;
height:81px;
background:#FFF3DB url("$imageHost/scribe_bg_paper_bot_w.jpg") no-repeat top left;
...
}

#wrap2 {
width:900px;
background:#FFF3DB url("$imageHost/scribe_bg_paper_mid_w.jpg") repeat-y;
...
}

#header {
background:url("$imageHost/scribe_divider_w.gif") no-repeat bottom $startSide;
}

#footer {
clear:both;
background:url("$imageHost/scribe_divider_w.gif") no-repeat top $startSide;
...
}

That's it! Click SAVE TEMPLATE and you should now have more room to play around with, in your main post area.

Note: You are free to use the images provided by me. But if you change your template according to this tutorial and use those images, please add the following code shown in red, right to the end of your template, in the place shown. It will simply link to this blog.

</div>

<a href="http://www.bloggerguide.lk/2008/04/wider-2-column-templates-step-by-step.html">Wider Two Column Modification</a> courtesy of <a href="http://www.bloggerguide.lk">The Blogger Guide</a>

</body>
</html>

Tuesday, May 27, 2008

Denim with a wider post area

Article Series: Wider 2 Column Templates - Step by Step Guides

Here are the steps to increase the width of the main post area of the Denim template by a desired amount. This is useful if you frequently upload images/embed videos etc that are wider than the default width of the post column.

1) Decide the amount of pixels by which you want to increase the width of the post area. In this article, I will be expanding it by 200 pixels. (In fact, you can pick an arbitrary size and experiment to see if that is enough for you)

2) Increase the width of the post area

  • Go to Layout -> Edit HTML
  • Locate the #main-wrapper CSS selector (Do a Find using your browser)
  • Increase its width property by adding the amount of pixels picked in step (1). Here we change it to 664 by adding 200 to the default width of 464 pixels.

#main-wrapper {
width: 664px;
float: $startSide;
...
}

3) Increase the width of the other wrappers to accommodate the expanded main wrapper.
  • Locate the CSS sections called #content-wrapper and #header
  • Increase their width property by the same amount of pixels selected in step (1)

#content-wrapper {
width: 960px;
margin: 0 auto;
...
}

#header {
width: 960px;
margin: 0 auto;
...
}

That's it! Preview and experiment with different increments. Click SAVE TEMPLATE once you get the required increment.

You should now have more room to play around with, in your main post area.

Wednesday, May 21, 2008

Template Variables

The new Layouts templates have "template variables", which are very useful when it comes to defining the look and feel of your blog. Here are some commonly asked questions about template variables.

What is a template variable?
A variable in programming can be considered as a placeholder for a value that can change from time to time. A variable can be assigned a value and, from elsewhere in the computer program, you can use that assigned value. Template Variables in Blogger is just the same concept applied within the scope of Blogger templates.

Where can I see them?
These variable are usually located right at the beginning of the blog skin. When you open your template Edit HTML mode (i.e. Layout -> Edit HTML), you can see a section called "Variable definitions". All the variable are defined in this section.

What is the format of a variable?
A template variable is defined in a syntax similar to XML/HTML elements, inside a <Variable> tag. However, these tags don't have a closing tag (i.e. </Variable>) nor they are empty elements (i.e. <Variable .../>).

Each variable has 5 attributes.
  • name: The unique name or id of the variable. The name cannot contain spaces
  • description: A short description of the variable. This is what works as the "display name" of the variable in the Font and Colors pane. (See figure below)
  • type: The type of the variable (See the next question for more details)
  • default: The template default value for the variable. Whenever you choose the "Revert to template default" option, it is this value that gets applied to the variable in concern.
  • value: The current value of the variable.
The link between a variable description and its display name is illustrated below.


What are the different types of variables?
Currently, there are 3 types of variables. They are:
  • color: Different color elements such as Text Color, Page Background Color etc.
  • font: Different fonts used in the template such as Text Font, Sidebar Title Font etc.
  • automatic: Miscellaneous variables [e.g. startSide and endSide, that are used to control the "reading order" (left-to-right or right-to-left) of the blog language]
font and color variables are editable both through the Fonts and Colors pane and the Edit HTML mode, whereas the automatic variables are only modifiable via the Edit HTML mode.

How can I add a new variable?
You can add new variables very easily. Copy and paste an existing variable of the type you want and provide a unique name and a description for it. If it is a font or color variable, it will be readily visible in the Font and Colors pane.

For example, to add a variable to control the sidebar text font in Minima template, you can add the following variable to the "Variable definitions" section. (Additional lines breaks are added for clarity. All of this can be in the same line)

<Variable
name="sidebarbodyfont"
description="Sidebar Text Font"
type="font"
default="normal normal 100% Georgia, Serif"
value="normal normal 100% Georgia, Serif"
>

Once added, it will be visible as follows.

But adding the variable is only part of the job. Next you have to use it in the relevant CSS selector. In this example, we need to modify the .sidebar selector and insert the line shown in red below. Note that when variables are used (i.e. referenced) elsewhere in the template, its name should be prefixed with a '$' character.

.sidebar {
color: $sidebartextcolor;
line-height: 1.5em;
font: $sidebarbodyfont;
}

What is the scope of template variables?
These variables are visible and available (scope in programming terms) for use only in the Edit HTML mode of your template. Once a blog page actually gets loaded, all the uses of the variables (all $name instances) get substituted with the actual value of the variable defined in the value attribute.

They cannot be used from the blog post editor as well.

Thursday, May 1, 2008

HOWTO: Backup and Restore your Template

Blogger provides an option where you can edit the template directly in HTML mode. This mode allows you to do a lot more customization than possible using its standard interfaces. For example, if you want to convert your blog to 3 columns or increase the width of your post area, you can do it using the Edit HTML mode.

However, most non-technical Bloggers are somewhat afraid of trying out such changes, even by following simple step by step guides. The Backup and Restore option should give you that additional bit of confidence to go ahead and try out a bit of tinkering by yourself.

This article will illustrate how you can back up and restore your template. It's very easy.


Backup
To backup your template go to Layout -> Edit HTML. The very first option in this pane is "Backup / Restore Template". Under that click the link "Download Full Template" (See Label 1 in the above figure). Choose the option to "Save" from the next dialog that pops up. Browse to the location you want to save it (e.g. Desktop) and click Save.

The template will be downloaded to the specified location. It's a small XML file and will be named as "template-<your blog id>.xml" where <your blog id> is a long series of digits. That's it; this XML file has all the details of your current template.

Restore
Restoring is also as simple as backing up.

Let's say you tried out some changes for your template and didn't get it right. When you try to save your template you get this frightening error message in red! (Clear Edits will not work here because you have saved your changes)

Don't panic. Remember you backed up your template earlier. Just click the Browse button (Label 2 in above figure) of the Backup / Restore option and browse to the downloaded template file and click Open. Then click Upload (Label 3). Then Blogger will restore your template to the state it was, prior to your edits. Then save your restored template.

You will be back to square one. Try your change some other day. As long as you back it up properly, you can restore it until you get your change right. :)

Saturday, April 26, 2008

HOWTO: Customize Fonts and Colors

Fonts and Colors in the Blogger templates can be used to tweak the look and feel of a given blog. The usual way of changing them is to use the Fonts and Colors pane.


However, this option gives you only a limited set of colors and fonts. There are two other, slightly advance ways in which you can customize the fonts and colors in your template. They are:

I will use the Minima template as an example. (Though most templates use a common set of variables, some have slightly different variables depending on the design of the template)

Use of template variables
Let's say you want to change the Text Font from the default Georgia font. The Font and Colors option gives only 5 other fonts. If you want to use a different font other than the given ones, you can do so using the bodyfont variable.

Go to Layout -> Edit HTML and scroll down to the "Variable definitions" section in the template skin. Locate the bodyfont variable. (See figure below)


As you can see, the bodyfont variable has 5 attributes. In this article, we will focus on the two attributes named default and value. (See the article on Blogger Template Variables for a detailed discussion on them) The attribute default contains the default Text Font for the Minima template. Whenever you click the "Revert to template default" option in the Fonts and Colors pane, Blogger applies these default font settings. The attribute value contains the current settings for the Text Font.

It is not adviceable to change the settings in the default attribute. The prudent way to set a different font is to change the value attribute. For example, if you want to use the font Tahoma, you need to change it as shown below.

<variable name="bodyfont" description="Text Font" type="font"
default="normal normal 100% Georgia, Serif"
value="normal normal 100% Tahoma, Serif">

Color variables work the same way. You should provide a hexa-decimal number as the RGB color value. Changing the text color to blue can be done as follows.

<variable name="textcolor" description="Text Color" type="color"
default="#333" value="#0000ff">

Direct modification of the CSS code
The second method is to directly modify the CSS code in your template skin. For example, let's consider the textcolor variable. The variables defined in the "Variable definitions" section are accessed elsewhere in the skin by prefixing its name with a '$' character as in $textcolor. Do a Find (Ctrl+F) in your browser for the string '$textcolor' to see where it is used. In Minima, one use of that variable is in the body CSS selector.

body {
background:$bgcolor;
margin:0;
color:$textcolor;
...
}

When the blog actually gets loaded in a browser, the Blogger platform will replace this variable with the color specified in the value attribute of the textcolor variable. You can directly specify a color value in this place, bypassing the replacement step. Here you can provide an RGB value or one of the standard 16 color names. For example:

body {
background:$bgcolor;
margin:0;
color:#ff0000;
...
}

body {
background:$bgcolor;
margin:0;
color:red;
...
}

(In addition to the standard 16 color names, most browsers support this extended set of color names)

Remember, however, that using the direct modification method to replace existing variables is of little use, because thereafter, any modification you do through the Fonts and Color pane has no affect on the variables you replace. Use the direct modification method when you want to override one of the template defaults or you want to tweak the look and feel in a manner not provided by the template.

Related Posts

Friday, April 25, 2008

Rounders with a wider post area

Article Series: Wider 2 Column Templates - Step by Step Guides

Here are the steps to increase the width of the main post area of the Rounders template by a desired amount. This is useful if you frequently upload images/embed videos etc that are wider than the default width of the post column. (For other Rounders templates, check the series home given above)

The Rounders template uses images for the rounded header, footer and borders of the main post area. We need to expand these images when increasing the width of the post area. This tutorial uses custom images hosted on The Blogger Guide companion web site. (Note: The images used by templates must be hosted online.)

(Note: Ensure that you back up your template before doing any changes, to be able to restore if anything goes wrong)

1) Decide the amount of pixels by which you want to increase the width of the post area. In this article, I will be expanding it by 240 pixels. (Note: You need background images that are expanded by the same size as the amount of pixels by which you expand your template. The steps here will only work for an expansion of 240 pixels)

2) Increase the width of the post area and its background images

  • Go to Layout -> Edit HTML
  • Locate the #main-wrap1 CSS selector (Do a Find using your browser)
  • Increase its width property by adding the amount of pixels picked in step (1). Here we change it to 725 by adding 240 to the default width of 485 pixels
  • Add a template variable to define the image host location as explained here. (This step will open up in a separate window. Return to the next bullet point after that)
  • Change the URL of the background property to the one shown in red below
#main-wrap1 {
width:725px;
float:$startSide;
background:$mainBgColor url("$imageHost/rounders_corners_main_bot_w.gif") no-repeat $startSide bottom;
margin:15px 0 0;
...
}
  • Locate the #main-wrap2 CSS selector
  • Change the URL of the background property to the one shown in red below
#main-wrap2 {
float:$startSide;
width:100%;
background:url("$imageHost/rounders_corners_main_top_w.gif") no-repeat $startSide top;
padding:10px 0 0;
}
  • Locate the #main CSS selector
  • Increase its width property to 725
  • Change the URL of the background property to the one shown in red below
#main {
background:url("$imageHost/rounders_rails_main_w.gif") repeat-y $startSide;
padding:0;
width:725px;
}
  • Locate the following CSS selectors and change their width properties as shown in red below.
.main .widget {
margin-top: 4px;
width: 708px;
padding: 0 13px;
}

.main .Blog {
margin: 0;
padding: 0;
width: 724px;
}
3) Increase the width of the other wrappers to accommodate the expanded main wrapper.
  • Locate the CSS section called #outer-wrapper
  • Increase its width property by the same amount of pixels selected in step (1)
#outer-wrapper {
width: 980px;
margin: 0 auto;
...
}
4) Replace the other background images with expanded ones as necessary.
  • Locate the following CSS selectors.
  • Replace the URLs of the images to the ones shown in red below.
#header-wrapper {
background:url("$imageHost/rounders_corners_cap_top_w.gif") no-repeat $startSide top;
...
}

#header {
background:url("$imageHost/rounders_corners_cap_bot_w.gif") no-repeat $startSide bottom;
...
}

#footer-wrap2 {
background:$titleBgColor url("$imageHost/rounders_corners_cap_top_w.gif") no-repeat $startSide top;
color:$titleTextColor;
}

#footer {
background:url("$imageHost/rounders_corners_cap_bot_w.gif") no-repeat $startSide bottom;
padding:8px 15px;
}

That's it! Click SAVE TEMPLATE and you should now have more room to play around with, in your main post area.

Note: You are free to use the images provided by me. But if you change your template according to this tutorial and use those images, please add the following code shown in red, right to the end of your template, in the place shown. It will simply link to this blog.

</div>

<a href="http://www.bloggerguide.lk/2008/04/wider-2-column-templates-step-by-step.html">Wider Two Column Modification</a> courtesy of <a href="http://www.bloggerguide.lk">The Blogger Guide</a>

</body>
</html>

Tuesday, April 22, 2008

Minima with a wider post area

Article Series: Wider 2 Column Templates - Step by Step Guides

Here are the steps to increase the width of the main post area of the Minima template by a desired amount. This is useful if you frequently upload images/embed videos etc that are wider than the default width of the post column.

(Note: Ensure that you back up your template before doing any changes, to be able to restore if anything goes wrong)

1) Decide the amount of pixels by which you want to increase the width of the post area. In this article, I will be expanding it by 200 pixels. (In fact, you can pick an arbitrary size and experiment to see if that is enough for you)

2) Increase the width of the post area

  • Go to Layout -> Edit HTML
  • Locate the #main-wrapper CSS selector (Do a Find using your browser)
  • Increase its width property by adding the amount of pixels picked in step (1). Here we change it to 610 by adding 200 to the default width of 410 pixels.
#main-wrapper {
width: 610px;
float: $startSide;
...
}

3) Increase the width of the other wrappers to accommodate the expanded main wrapper.
  • Locate the CSS sections called #outer-wrapper, #header-wrapper, #header .description and #footer
  • Increase their width property by the same amount of pixels selected in step (1)
#outer-wrapper {
width: 860px;
margin: 0 auto;
...
}

#header-wrapper {
width: 860px;
margin: 0 auto 10px;
...
}

#header .description {
margin:0 5px 5px;
padding:0 20px 15px;
max-width:860px;
...
}

#footer {
width: 860px;
clear: both;
margin: 0 auto;
...
}

That's it! Preview and experiment with different increments. Click SAVE TEMPLATE once you get the required increment.

You should now have more room to play around with, in your main post area.