Create Your Own Blogger Template

A step-by-step guide to creating your own beautiful Blogger template. Learn about Blogger tags, how to use images, and how to tweak your template CSS.

HTML code and palm treesOne of the nice things about Google's free Blogger service is that you can easily change the look of your blog. On a simple level, you can tweak the blog's fonts and colours via the Fonts and Colors tab in the admin area, and add, remove and reposition blog widgets with the Page Elements tab.

If you want to alter your blog's design more radically, though, then you'll need to change your blog's template. There are many nice free Blogger templates available for download, but for a really professional job and a unique look, you'll want to create your own template.

This easy-to-follow tutorial walks you through all the steps needed to make your own Blogger template. To save time, you'll start from an existing HTML template — our free Tope PageKit — rather than creating a template entirely from scratch. However, once you've followed this tutorial you'll have the knowledge to create your own Blogger template from the ground up.

Overview

Here's how you're going to create your Blogger template:

  1. Download the Tope PageKit and extract it
  2. Create a test blog in Blogger for testing your template
  3. Open a copy of Tope's index.html file in your text editor
  4. Replace the top chunk of the template code with the standard Blogger code
  5. Insert the CSS from the Tope template's style sheet, style.css
  6. Remove the right-hand sidebar from the template
  7. Upload the template images and fix up the image URLs in the template
  8. Test the template
  9. Add the Blogger tags to the template
  10. Test again
  11. Tweak the template CSS to work with the Blogger markup
  12. Test the finished template

Ready? Let's get going!

1. Download the Tope PageKit

Grab the Tope PageKit zip file and extract it to a folder called tope on your computer. When you open the folder you should see the files that make up the Tope template, including index.html and style.css.

2. Create a test blog

It's a good idea to create a separate blog for developing and testing your template. This will allow you to play with the look of your template without affecting your main blog.To create your test blog, follow these steps:

  1. Log into your Blogger account.
  2. In the Dashboard, click Create a Blog.
  3. Enter a title, such as "My Test Blog", and a unique blog address (URL) — it doesn't matter what you use.
  4. Fill in the word verification section, then click Continue.
  5. On the "Choose a template" page, click Continue again.
  6. Your test blog has been created. Click the Start Blogging button.

3. Copy the PageKit's index.html file to a new Blogger template file

Most PageKits come with 2 template pages:

  • index.html for the site homepage, and
  • page.html for all of the site's inner pages

Blogger uses just 1 template page for all pages of a blog, so you'll base your Blogger template on the PageKit's index.html page and ignore the page.html file.

Now, open the tope folder on your hard drive and find the index.html file. Copy this file to a new file called tope.xml. This will be your Blogger template. Open tope.xml for editing in your favourite text editor (I like to use Notepad on Windows and TextWrangler or vim on the Mac).

4. Replace the top chunk of the PageKit's markup with Blogger's

A Blogger template contains various custom tags and attributes in its html and head elements. These tags are needed by Blogger to display the blog pages, so you'll need to replace these 2 elements in the tope.xml file with the following Blogger code:


<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
  <head>
    <b:include data='blog' name='all-head-content'/>
    <title><data:blog.pageTitle/></title>
    <b:skin><![CDATA[

/* Insert CSS Here */

]]></b:skin>
  </head>

To replace the code, follow these steps:

  1. Open tope.xml in your text editor.
  2. Select the above chunk of code and choose Edit > Copy.
  3. In tope.xml, select everything from the start of the file down to the closing </head> tag, and choose Edit > Paste.
  4. Save the tope.xml file.

5. Insert the Tope CSS

Blogger templates use special elements to identify various parts of the template, such as the blog posts and sidebar widgets.

The first Blogger element you'll work with is called b:skin, and it's inside the head element you just pasted in. Amongst other things, the b:skin element holds the template's CSS styles, so you need to insert Tope's CSS into this element. Follow these steps:

  1. In the tope folder, open the tope.xml and style.css files in your text editor.
  2. Select the entire contents of the style.css file and choose Edit > Copy.
  3. In the tope.xml file, select the /* Insert CSS Here */ line near the top of the code, and choose Edit > Paste.
  4. Save tope.xml.

6. Remove the right-hand sidebar

The Tope PageKit has a 3-column layout:

  • The site title/menu column on the left (<div id="page-header"> ... </div>)
  • The main content column in the middle (<div id="main-content"> ... </div>)
  • A narrow sidebar column on the right (<div id="sidebar"> ... </div>)

You'll use the left menu column to hold the Blogger sidebar widgets, and the main content column for the main Blogger content (i.e. the blog posts). This means that you don't need that right-hand sidebar column, so rip it out and extend the main content width to fill the gap.

To do this, first remove the <div id="sidebar"> ... </div> section from the tope.xml file. You should now have the following markup between your <!-- Content --> and <!-- End Content --> comments:


    <!-- Content -->

    <div id="main-content">

      <p>Lorem ipsum dolor sit amet, con sectetuer adipiscing elit, sed diam nonnumy nibh eeuismod tempor inci dunt ut labore et dolore magna ali quam erat volupat.  Ut wisi enim ad minim veniam, quis <a href="#">nostrud</a> exerci tation ullamcorper suscipt laboris nisl ut aliquip ex ea commodo consequat.  Duis autem vel eum irure dolor in henderit in vulputate velit esse consequat.</p>

      <p>Vel illum dolore eu feugiat nulla facilise at vero eos et accusam et ius to odio dignissim qui blandit prae sent luptatum zzril delenit aigue dous dolore et molestias exceptur sint occaecat cupidiata non simil pro vident tempor sunt in clulpa qui officia deserunt mollit anium ib est abor um et dolor fuga.  Et harumd dereud facilis est er expedit distinct.  Nam liber tempor cum soluta nobis eligend option congue nihil impediet doming id quod mazim placeat facer possim omnis voluptas assumenda est, omnis repellend.</p>

      <p>Temporibud auteui quinusd et aur office debit aut tum rerum neccessit atib saepe eveniet ut er molestia non recusand.  Itaque earud rerum hic ten tury sapient delectus au aut prefer zim endis dolorib asperiore repellat.</p>

    </div>

    <!-- End Content -->

Now remove the corresponding #sidebar selector from the CSS (inside the b:skin element). Delete the following code:


/* Sidebar area */

#sidebar
{
  float: right;
  width: 190px;
  padding: 2px 10px 0 0;
  font-size: 0.9em;
  line-height: 1.2em;
}

Next, you need to increase the width of the main content area so it stretches to fill the gap where the sidebar was. To do this, find the #main-content selector in the CSS and change the width from 340 pixels to 550 pixels:


/* Main content area */

#main-content
{
  float: left;
  width: 550px;
}

7. Upload the template images and adjust the image URLs

Tope's index.html template file uses 3 images:

  • palms-big.jpg (the top-right palm trees image)
  • pinstripe.png (the repeating pinstripe page background)
  • footer-rule.png (the white dotted border above the page footer)

You need to upload these images to the Web somewhere so that the blog template can use them. The easiest approach is to upload them to your own website (if you have one), although it's also possible — albeit fiddly — to upload them to Blogger by creating a blog post.

Here's where I uploaded my images:

The original Tope template references its images in an images folder relative to the template page. You'll need to adjust these references to point to the images you uploaded.

In tope.xml, find the references to:

  • palms-big.jpg (in the "main-image" img tag towards the bottom of the file)
  • pinstripe.png (in the body CSS rule)
  • footer-rule.png (in the #page-footer CSS rule)

and replace the URLs with those of your uploaded images. My new code looks like this (changes highlighted in bold):


<img id="main-image" src="http://www.elated.com/res/Image/articles/authoring/create-your-own-blogger-template/palms-big.jpg" alt="Palm trees" style="height: 379px;" />

body
{
  margin: 0;
  padding: 0;
  color: #393b4a;
  background: #d4d5c5 url(http://www.elated.com/res/Image/articles/authoring/create-your-own-blogger-template/pinstripe.png) repeat 0 0;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 0.85em;
  line-height: 1.3em;
}

#page-footer
{
  margin: 10px 0 0 0;
  padding: 20px 0;
  background: transparent url(http://www.elated.com/res/Image/articles/authoring/create-your-own-blogger-template/footer-rule.png) repeat-x 0 0;
}

8. Test the template

So far you've taken the Tope template file, added the Blogger html and head code, inserted the CSS from Tope's style.css file, uploaded the images, and fixed up the image URLs. How's it all looking so far?

To test your template:

  1. Log into your Blogger account.
  2. Find your test blog in the Dashboard and click its Layout link.
  3. Click the Edit HTML tab.
  4. Click the Browse button and choose the tope.xml file on your hard drive, then click Upload.
  5. You'll probably see a "Widgets are about to be deleted" warning message. Don't worry, as this is only a test blog. Just go ahead and click Confirm & Save.
  6. Click the View Blog link to view your test blog.

You can see that your test blog now looks pretty much like the Tope homepage template, minus the right-hand sidebar which you removed previously:

Template with no Blogger tags
The template so far — no Blogger tags yet

However, it doesn't look much like a blog! That's because the template body doesn't contain the required Blogger tags to display things like the blog posts and sidebar widgets. You'll add these tags in the following step.

9. Add the Blogger tags

You now need to replace the static content in the template with various Blogger tags to display your blog posts, sidebar widgets, and other dynamic content. The most common types of Blogger tags are:

  • b:section tags, for marking out broad sections of the page such as the header, footer, sidebar, and main content area
  • b:widget tags, for inserting specific widgets (also called gadgets) in the page, such as the blog title/description, the Blog Archive links, and the blog posts themselves.

In this tutorial you'll add a few basic Blogger tags to get your blog template working, but there are a lot more tags that you can add. Find out more about Blogger section and widget tags.

9a. Replace the Site Title section with the Blogger "header" section

First, you'll replace the big "Site Title here" text in the Tope template with the blog title, and the "Introduce the site here with a little bit of copy" text below it with the blog description. The following Blogger tags can be used to display the blog title and description:


    <b:section class='header' id='header' maxwidgets='1' showaddelement='no'>
    <b:widget id='Header1' locked='true' title='My Blog (Header)' type='Header'/>
    </b:section>

To insert the tags, follow these steps:

  1. Select the chunk of code above and choose Edit > Copy.
  2. Open tope.xml in your text editor and select the code between the <!-- Site Title --> and <!-- Menu --> comments.
  3. Choose Edit > Paste to replace this code with the copied code.

Your Site Title section in tope.xml should now look similar to this:


    <!-- Site Title -->

    <b:section class='header' id='header' maxwidgets='1' showaddelement='no'>
    <b:widget id='Header1' locked='true' title='My Blog (Header)' type='Header'/>
    </b:section>

9b. Replace the Menu section with the Blogger "sidebar" section

Tope's Menu section fills the rest of the left-hand column below the site title. You're going to use this area to display all your Blogger sidebar widgets, rather than Tope's default navigation menu.

Using the same technique shown in Step 9a above, replace the code between the <!-- Menu --> and <!-- End Menu --> comments in tope.xml with the code shown below. This creates the Blogger "sidebar" section and adds 3 default widgets: Followers, Blog Archive, and Profile (About Me):


    <!-- Menu -->

    <b:section class='sidebar' id='sidebar' preferred='yes'>
    <b:widget id='Followers1' locked='false' title='Followers' type='Followers'/>
    <b:widget id='BlogArchive1' locked='false' title='Blog Archive' type='BlogArchive'/>
    <b:widget id='Profile1' locked='false' title='About Me' type='Profile'/>
    </b:section>

    <!-- End Menu -->

9c. Replace the main content dummy text with the Blogger "main" section

You're now going to replace the dummy text in the Tope main content area with the Blogger "main" section tags. This section displays your actual blog posts.

Using the technique shown in Step 9a, replace the dummy Lorem Ipsum text inside the "main-content" div in tope.xml with tags for the Blogger "main" section and "Blog" widget, as shown below:


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

9d. Add the Blogger "footer" section

Finally, you need to add the Blogger "footer" section to the Tope page footer. (You'll keep the PageKits copyright notice and links, as required by the Terms of Use for free PageKits.) The footer won't contain any widgets for now.

Add the "footer" section just above the copyright notice code, as shown below:


  <!-- Page Footer -->
  <div id="page-footer">
    <b:section class='footer' id='footer'/>
    <p>ELATED PageKits &copy; 1996-2008 <a href="http://www.elated.com/">ELATED</a> &amp; <a href="http://www.pagekits.com/">PageKits.com</a></p>
  </div>

10. Test the template again

Now you can test the dynamic areas of your template. First, add some test content to your blog:

  1. Click your test blog's Settings tab.
  2. Enter some dummy text for the Description field, then click Save Settings.
  3. Click the Posting tab.
  4. Click New Post, then enter some dummy text for the post title and content. You may also like to add some labels. Click Publish Post when you're done.
  5. Repeat the last step a couple of times, so that your blog contains a few dummy posts.

Next, upload your tope.xml template again, as shown in Step 8. View your test blog. You can see that it now looks more like a blog, with your blog header, title, description, sidebar widgets, and blog posts all in place:

Template with Blogger tags
The template with Blogger tags inserted

However, things look a bit rough round the edges. For example, some of the headings are too small, and the spacing of various elements is a bit off. This is due to incompatibilities between the Tope CSS and the HTML generated by Blogger. You'll fix these in the following step.

11. Tweak the CSS

In this step you'll improve the appearance of your tope.xml template by making some tweaks to the CSS in the b:skin section at the top of the file.

11a. Sidebar positioning

It would be good if the sidebar widgets (Followers, Blog Archive and so on) started further down the sidebar, lining up with the date heading in the blog posts area. To do this, you can give the #header element, which comprises the blog title and description, a fixed height. Add the following CSS to the end of the existing CSS in the tope.xml file:


#header
{
  height: 336px;
}

11b. Blog Archive spacing

The Blog Archive links are bit cramped. To space them out vertically, add the following CSS:


#page-header li
{
  margin: 0;
  padding: 0 0 .25em 15px;
  text-indent: -15px;
  line-height: 1.5em;
}

11c. Link underlining

Some links are underlined, while some aren't. For consistency, you can remove underlines from all links, apart from those in the post bodies, by adding the following CSS:


a
{
  text-decoration: none;
}

.post-body a
{
  text-decoration: underline;
}

11d. The About Me section

The About Me section features the author photo and description. Currently this section doesn't have any CSS applied, so it looks pretty messy. You can fix this by adding the following CSS:


.profile-img
{ 
  float: left;
  margin: 5px 5px 5px 0;
  padding: 0;
  border: 1px solid #333;
}

.profile-data
{
  margin: 0;
  font-weight: bold;
  line-height: 1.6em;
  font-size: 0.8em;
}

.profile-datablock
{ 
  margin: 0.5em 0 0.5em;
}

.profile-textblock
{ 
  margin: 0;
  line-height: 1.2em;
  font-size: 0.9em;
}

.profile-link { 
  font-size: 0.9em;
}

11e. Line spacing

The lines of text look a bit cramped vertically. To increase the line spacing, change the line-height property in the body selector from 1.3 ems to 1.5:


body
{
  margin: 0;
  padding: 0;
  color: #393b4a;
  background: #d4d5c5 url(http://www.elated.com/res/Image/articles/authoring/create-your-own-blogger-template/pinstripe.png) repeat 0 0;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 0.85em;
  line-height: 1.5em;
}

11f. Level 3 headings

The post titles, which are h3 heading elements, look far too small. Since they're links, they also inherit the link colours. It would be nicer if they had their own colour.

To fix both of these issues, simply increase the h3 font size from 0.8 ems to 1.3 in the CSS, and add selectors to style the h3 links:


h3
{
  font-weight: bold;
  font-size: 1.3em;
  margin: 0 0 10px 0;
}

h3 a:link, h3 a:active, h3 a:visited
{
  color: #a0854f;
}

h3 a:hover
{
  color: #000;
}

11g. Post footers

The post footers ("Posted by...") could do with a little separation from the post bodies, and it would be good to increase the vertical space between lines of text in the footers. Add the following CSS to space the footers vertically and give them a grey italic font:


.post-footer
{
  margin: 1em 0;
  line-height: 1.6em;
  font: italic normal 100% Georgia, "Times New Roman", Times, serif;
  color: #666;
}

.post-footer div
{
  line-height: 1.6em;
}

11h. Separator bars

It would be nice to have some dotted horizontal bars separating various elements in the page. Add these into tope.xml by adding the following CSS:


.post
{
  margin: .5em 0 1.5em;
  border-bottom: 1px dotted #333;
  padding-bottom: 1.5em;
}

.sidebar .widget, .main .widget
{ 
  border-bottom: 1px dotted #333;
  margin: 0 0 1.5em;
  padding: 0 0 1.5em;
}

11i. Pager links

Individual post pages contain "Newer Post" / "Home" / "Older Post" links at the bottom of the page. You can line these up nicely by adding the following CSS:


#blog-pager
{ 
  text-align: center;
  margin-bottom: 2em;
}

#blog-pager-newer-link
{
  float: left;
}
 
#blog-pager-older-link
{
  float: right;
}

12. Test the finished template

You've now tweaked your template's CSS to get everything looking good. Time to test your finished template!

Re-upload your tope.xml template, as shown in Step 8. View your test blog. It should look much more polished. Try adding a few comments to your posts, and make sure everything looks right. Here's how a blog post page should look:

Finished template showing a blog post page
The finished template showing a blog post page

Nice work! If you want, you can download the finished tope.xml file.

In this tutorial you've learned how to create a basic Blogger template. Blogger lets you take things further, though. For example, you can fully customize each widget by inserting data tags inside the widget tags, and you can even create your own widgets.

Another nice enhancement — particularly if you want others to use your template — is to make the template's fonts and colours tweakable via the Blogger Fonts and Colors tab. To do this, you need to insert Blogger variables into your template.

Happy blogging! :)

Follow Elated

Related articles

Responses to this article

20 most recent responses (oldest first):

17-Jul-11 11:41
This is the most detailed and helpful tutorial, especially if you're someone who's not as experienced with code, etc. I think what many people forget is that there are a lot of people out there who don't know all the code "lingo" and are beginners. Thanks for putting your time and work into this. As far as the one who's unappreciative (blackhawk), maybe you could write your own tutorial if you feel you can do better.
18-Jul-11 23:55
@Karlyn324: Thanks very much for your comment - I'm glad you found the tutorial helpful.

Matt
15-Sep-11 05:36
finally i found this amazing tutorial, creating Blogger template. thank you very much !!
05-Jan-12 06:16
look so super simple, that was fast. If you have time later I'll try to apply in my blog template
13-Jan-12 16:23
Hello, I am new here. I registered specifically to thank you and to let people now that as for January 2012 this tutorial works, there is no errors and everything looks great. I just added a blog to my existing site and didn't want my visitors to feel like they landed on an alien planet when they click on BLOG. So I uploaded my own code using this tutorial. It looks just like my website pages. Here it is http://goo.gl/sLHlO

Thank you very much!
Gep
17-Jan-12 15:21
Hey, nice tutorial but I have some questions.

1. Can I make my template so that style.css stays separate and them upoad it in tope.xml file

2. If I don't choose a template I don't get the layout link option. I only get it when I choose some template. Then a new problem occurs. I can't upload the file because I can't find anything to upload my folder from.
Gep
18-Jan-12 12:53
Ok, don't mind the second point. I found a way to upload files but not exactly like you said. Maybe they changed it or something.

I'm still interested in 1. question.

The second question now looks like this: how to create a xml file? I mean I looked up "how to" on google but it seems a bit complicated and demands coding.
18-Jan-12 13:15
@Gep

Regarding Q1 that's exactly what I did. I created xml file in Dreamweaver and then coded normal HTML as you would do with a normal website. I also created a separate style.css Then you either can copy and paste that style.css right in the head of your xml document or go to Template Designer, Advanced and paste your style.css contents right there.

To be honest I found it much easier to use old Blogger interface for this task. So I pasted style.css in the head of my xml file then went to Edit HTML and everything worked fine. In fact it is as simple as designing a normal CSS website, the difference is that you have to paste some specific Blogger codes in right places. I was absolutely thrilled by how simple it was.
Gep
18-Jan-12 15:05
Thanks for the answer!

By the way, did you get any errors when uploading your template? I get an error called "bX-z9vkvi" and it seems like I am not the only one.
18-Jan-12 15:33
No, there was no errors except when I made a mistake in HTML, I think I forgot to close one </div>, but I don't remember what it said. Maybe you also have something like this? Did you validate your HTML before inserting Blogger tags?
Gep
19-Jan-12 13:00
Well I tried to validate both HTML and XML file but there is only 1 option in DW for this: File/Validate/As XML - someone said that you can validate HTML with XML option because they are somehow similar.

I really don't know because I am new to all this stuff and don't know these things to well.
19-Jan-12 14:35
Okay no problem. It's not that I am an expert myself, but i did it and I also make some simple CSS templates, which also helps.

So in the beginning, you should have a simple index.html and style.css, which is just a normal template. Validate your HTML at http://validator.w3.org/ (choose direct input). Do this before you open .xml file. Make sure it passes the test, if it doesn't Blogger will be giving you error and you won't know where it is.

Then go back to your HTML editor and create a new .xml file. In my editor it opens by default with <?xml version="1.0" encoding="utf-8"?> Paste your HTML from index.html right under that line. Then follow instructions in this post very carefully. You will have to delete some parts and replace some parts as you already know.

I hope this helps. Good luck to you!
31-Jan-12 09:05
This is a really straight forward and helpful tutorial so THANK YOU! But, I find myself confused as to where to start from here... I understand the steps I took, but I still don't know how to manipulate the layout to make it my own...
02-Feb-12 22:51
@Ninj: You can take 2 approaches. If your design is fairly similar to an existing Blogger template, or the Tope example in the tutorial, then you can just tweak the HTML and CSS, testing as you go, until it matches your design. Alternatively, if your design is quite unique, then I would create a static HTML page from the design first. Once you're happy the that the HTML page looks good, insert the Blogger tags into the HTML to turn the page into a Blogger template.
03-Feb-12 14:35
WOW, I made this once again. This time for right-to-left language and everything works smoothly. Thanks!
07-Feb-12 23:09
@cleverfox: Great stuff
12-Apr-12 14:59
Hi Matt,
After modifying the template a little bit to make it minimalistic I'm unable to get the post body beside the sidebar widgets. The post body always below the sidebar widgets end making a huge blank gap beside the sidebar. Perhaps if there is anyway for you if could have a look at it, I'd be very grateful. I've been wracking my head since 4 days now.
Thanks very much.
05-May-12 15:55
hello my name is Adil and i am new to webmaster's community, i followed the step by step procedure twice but i am unable to test this theme in 8th step. itried to upload theme but blogger is gonna let it save .instead its giving following error
"We were unable to save your template.
Your template could not be parsed as it is not well-formed. Please make sure that all XML elements are closed properly. XML error message:
Could not find a preferred section to add deleted widgets to."
and when i tried to paste source code manually in "edit html". its still generating error.
i want to remind that in 1st try i gave the path of a photo being hosted by picasa and in 2nd try, i gave the path mentioned in above tutorial just to test , still not working either way
12-Jul-12 21:05
sorry anyone can tell me where can i find tope.xml?
13-Jul-12 03:01
@thany: You create tope.xml in Step 3.

View all 26 responses »

Post a response

Want to add a comment, or ask a question about this article? Post a response.

To post responses you need to be a member. Not a member yet? Signing up is free, easy and only takes a minute. Sign up now.

Top of Page