Blogger.com Help - Lesson 19 - Edit HTML Layout

There will come a time for those that really get into using Blogger that they'll want to modify and manipulate their blogger template to do things a little differently than the standard templates provide by default.  Perhaps you want to switch your standard Blogger theme to a custom theme that was built by someone else.  Maybe you want to create your own template, or perhaps make some simple changes.  In this lesson I'll cover the interface that allows you to do just that.

Being that one could write a book on templates and still not cover all there is to speak about, I'll try my best to discuss the interface and delve slightly into some of the code, but mainly this will cover the interface and how to use it.

Note to new visitors!  If you would like to know more about this series or view all available lessons, just follow the appropriate link.

Backup and Restore Template

The first item found on this page is perhaps...no, IS the most important of all the controls in the entire administration area.  The controls under the Backup / Restore Template header will save your butt, but only if you decide to use them.  So before doing any type of work on your template, you should make sure that you can recover from disaster the best you can. 

I first want to point out that we can all define disaster as different things.  For instance, you might define it as anything that causes you to lose time.  You may consider it disastrous to have a single pixel line where there shouldn't be one, while your friends may simply overlook it.  Regardless of how you feel, Make sure you have a backup of your template! 

How might you do this?  Start off by downloading the template by clicking the Download Full Template link.  This will allow you to save the contents of your template to your local disk.  If, during your adventures in coding and template modification, you make an error or cause the New York city skyline to go dark, you can simply upload the template you just saved back into action by using the control immediately following the Download link.  New Yorkers everywhere will thank you.

Edit Template

The edit template section might look a little intimidating to some, but if you have a backup of your template, you can do whatever you want and still get back to normal with ease.  Besides, any changes you make are not put in place until you click the Save Template button found at the bottom of the page.

The first thing to note is that Blogger hides most of the template code from you by default.  The checkbox labeled 'Expand Widget Templates' will un-hide these sections so that you can see all of the template code.

For instance, the code shown below is the section of code that defines the footer area of the Views On Life template.  If you look closely, you'll see that the <b:widget /> line is a self-closing tag that when you choose to expand the widget templates, grows to several more lines, and is no longer a self-closing tag, but instead has a starting <b:widget> and a closing </b:widget> tag set.

<div id='Div1'>
    <b:section class='footer' id='footer'>
        <b:widget id='HTML4' locked='false' title='' type='HTML'/>
    </b:section>
</div>

When we expand the text by clicking the Expand checkbox, suddenly all these widget items become several lines of code that will look similar to this:

<div id='footer-wrapper'>
    <b:section class='footer' id='footer'>
        <b:widget id='HTML4' locked='false' title='' type='HTML'>
            <b:includable id='main'>
                <!-- only display title if it's non-empty -->
                <b:if cond='data:title != &quot;&quot;'>
                    <h2 class='title'><data:title/></h2>
                </b:if>
                <div class='widget-content'>
                    <data:content/>
                </div>
                <b:include name='quickedit'/>
            </b:includable>
        </b:widget>
    </b:section>
</div>

As you can see, there is much more code behind these widget items.

Another good thing to do when toying with your template code is to find a way to lay it out so that it makes sense to you.  You'll see the above 'footer-wrapper' <div> is the rightmost item, and everything between the starting and closing tag is indented about 4 spaces.  If you look at the next line, it also contains information in between its starting and closing tags, so those too are indented 4 spaces.  This allows you to read the code much easier, and it also is a common practice among programmers to help improve the readability of the code.

You won't be able to format the lines of code in the Blogger interface though, at least, not without a lot of hair pulling.  Instead, if you used a simple text editor like Notepad, it would make things much easier.  Simply paste your template code in, make your changes, format certain areas to help you understand it, copy and paste back into the template area in Blogger when you're done and test your changes.

Now, the trick is to understand what each line is doing, and what it means.  A person that can teach themselves, and determine where to get information can achieve that goal easily over time.  But it DOES take time and plenty of patience, a healthy passion for puzzles is probably a good trait too.

Let's say you decide that you want to make some changes within a particular widget and realize that your changes don't really look good, or worse, cause the blog to crash.  You can clear all your widget template items to their default state by clicking the revert widget templates to default link.

Some time ago, blogger switched the way they define templates.  They refer to the old template design as their Classic Template, while the new one is simply called a Template.  I don't suppose anyone who has the updated templates would want to go backward to the classic template so I won't go into the effects of doing this. 

Conclusion

This page contains the most valuable bit of information I could ever provide to you.  Make sure you have a backup of your template before you go and mess with it.   By not doing so, you are only allowing yourself to have headaches and issues later.  Don't allow yourself that, be a nice person and make a backup right now, while you are thinking about it and put it somewhere safe.  Someplace you'll remember. 

And by all means, if you are so inclined, you should play around with the code in your template.  Maybe not directly in your 'live' blog, but perhaps in another that only you have access to or won't affect your stream of visitors, or one that you don't care about failing, such as a test or staging blog.  I call these sandbox blogs, and they are quite handy when you want to try something new.

Further Reading

Here is a list of further reading you can do as it relates to understand more about the template code.  I will be finalizing more posts around templates, but I suspect there are those that just cannot wait.

Bare Bones Guide to HTML - Great place to learn more about HTML
Page Elements Tag for Layouts - Learn more about the specialized tags that Blogger uses
Widget Tags for Layouts - Learn more about the tags used for widgets
Layouts Data Tags - Learn more about the data tags that Blogger uses
Fonts and Colors Tags for Layouts - Fonts and Color tags

permalink Permalink or Trackback Comment Comments (13) Cat Blogger.com Step by Step
Technorati: No reaction yet!
Tags: , , , ,
Actions: E-mail

Can you dig it?

If you liked this or maybe found it helpful, please digg it, stumble it, buzz it, whatever it, to say thank you.



stumble

Add to Technorati Favorites

 
rss If you would like to receive these posts as they happen, you can subscribe to my feed or receive my posts in your email.

Related Posts

Comments

  1. Karen
    Karen Says:


    I want to do all of those things, but will not for fear of taking the entire thing down. Maybe another day when I'm feeling sassy!
  1. Wayne
    Wayne Says:


    Feeling sassy is probably a good approach to getting things done. Just be sure to make a backup as the first thing you do. Sorry for harping on that, but I would hate to have anyone start tinkering around with their templates and screw things up without having one.
  1. Jim
    Jim Says:


    Hey Wayne, great info and advice.

    My procedure is a lot less conventional. If I'm going to futz around quite a bit with my template's HTML, I back it all up by selecting it and then copying and pasting it into a new email (I save it to my draft folder, but of course it can put into any text editor) so that it's always there if want to paste it back.

  1. Wayne
    Wayne Says:


    Hi Jim, that works, and that's what matters right? You can recover from any mistakes, and you can bet that there will be mistakes. It's part and parcel to the process right?

    Thanks for leaving an alternative method, that may work better for others. Cheers!
  1. GaryJay
    GaryJay Says:


    having a backup goes along way to taking the fear outta making changes to ones template code---also seeing how the code is indented with tags within tags alsom kinda clarifies reading code. I having just recently moved to a 3 column template am for the moment sated on my need to change my template---but having read your lesson I am much better prepared to do so if and when I am ready to make additional changes. good lesson
  1. David
    David Says:


    I had a blogger blog once - wanted to change the template, I did, but I guess I messed something up because it wouldn't work anymore. I use Wordpress now, but that is neither here nor there. I totally agree with your sage advice no matter what system you use - backup!
  1. Wayne
    Wayne Says:


    Thanks Gary! I've seen your template and I think you did a great job with it.

    A blogger blog can be quite touchy eh David? Well, any of them are going to be touchy really, regardless of the platform simply due to the exacting nature of html and the conventions used. Thanks for dropping a comment! Maybe someday I'll go through WordPress too...
  1. Milly
    Milly Says:


    Thanks for the advice..I always mean to do a backup but never seem to get round to it..will do it today!
    I have a logo a friend made for me that I want to insert into my header but don't know how to get started..or even if it's possible with my template. Any suggestions?
  1. Wayne
    Wayne Says:


    Hi Milly, yes that is possible, but you want to make sure that it fits, and that it looks good too. If the image is a full banner intended to BE the header, then you can look at the Page Elements Layout screen and edit the header there. Check out lesson 17 part 1 for more info on that: www.waynejohn.com/.../...ents-Layout-(Part-1).aspx

    If the logo is a smaller graphic that doesn't fill the entire header, then you will need to dig into the template code to place and position the logo.

    I'd be happy to help you out, it isn't a huge task. If you want to do it yourself but are not sure of doing that, you could always create a new blog as a test to get over the hurdles you might face. Once you're happy there, do the same to your production blog.
  1. rawan
    rawan Says:


    Hi..
    I'am rawan from indonesia. the article you wrote is very helping me as beginner in world web. hopefully you can complete the article about edit layout using html. because I still try to find to formula of html layout for design my layout suit with my idea. thanks
  1. rawan
    rawan Says:


    1. Hi..
    I'am rawan from indonesia. the article you wrote is very helping me as beginner in world web. hopefully you can complete the article about edit layout using html. because I still try to find to formula of html layout for design my layout suit with my idea. thanks

    Saving the comment The comment was saved. Thank you for the feedback
  1. Wayne
    Wayne Says:


    Rawan, I'm actually still working on it. I have it basically built, but I'm trying to put it into a format that I think will be helpful. Most of my posts come straight from the head to the computer, so I need to edit quite a bit to make a post that will be understood. I found that I tend to write very cut and dry, not conducive to learning, so I need to spend a little more time with my posts sometimes. Templates are certainly no exception.

    Subscribe to my feed and you'll get it and more Blogger help.

    Thanks for letting me know you are interested in it, I appreciate it.
  1. trackback
    Wayne John Says:


    Trackback from Wayne John

    Adding Social Links To Your Blogger Posts

Add comment



(Will show your Gravatar icon)  

biuquote
  • Comment
  • Preview
Loading



Check it out mango: Any links must be entered as http://www.somewhere.com with nothing touching it. Anything else will be mangled. This is to help combat spam and to also ensure the masses know of this little tidbit before they click Save comment below. :) I have this down to remind me to do something with it, but I take things slow and easy on the old horse.

Keeps her regular don't ya know, and I wouldn't want to disturb that.



CSS Template by RamblingSoul | Illinois Wine. Adapted to BlogEngine by Wayne John
EatonWeb Blog Directory  Blog Directory LS Blogs Blog Directory Entrecard DropSurf
Powered By Ringsurf A1 Web Links