28 How I copy widgets from one template to another

When you choose a new default Blogger template, all of your widgets are copied over to the new template. However, if you try to upload a customized template (such as the ones featured here), you will probably get a message asking if you want to delete most of your existing widgets. I am often asked "how can I copy my widgets over to a new template?", so in this tutorial I will share the method I use to do this quickly and painlessly.

Your blog widgets are saved in your Blogger account, rather than in the actual template of the blog. The widgets are called to your blog by anchors within the template which look like this:

<b:widget id='HTML1' locked='false' title='My Widget Title' type='HTML'/>
As you can see in this example, each widget in your blog is given a unique identity (in this case, "HTML1") and a title, which is the same as the title you provide when you create the widget.

If you upload a template to your blog which contains the same widget identifiers, then the widgets will be called from your account by the template, and will display in your blog as normal. On the other hand, if you upload a template which does not contain the same widget identifiers, you will be prompted to delete widgets from your account.

So to ensure you can maintain your widgets from your existing blog template in your new blog template, we must copy these widgets over to the new template before uploading this to your blog.

The method I use to accomplish this is by using a second "test blog". I have explained all about creating and using a test blog in this post. If you don't already have a test blog available to use, you will need to create one temporarily to help you copy your widget identifiers over to your new template. Once you have created your test blog, here is the method for copying over your widgets from your old template to your new one:

  1. Log in to your Blogger dashboard.
  2. You will need to be able to edit both your existing blog template and your test blog template, so it's advisable to have two browser windows (or tabs) open at the same time. You can easily do this by keying CTRL+N to bring up a new page. So for the moment your Blogger dashboard will be available in both browser windows.
  3. Now, in the first browser window, select your test blog and go to Template>Edit HTML. Click on the "Upload New Template" link near the top of the page and upload the new XML template you wish to adapt for your main blog. Once this template has uploaded, deselect the "expand widget templates" box.
  4. In the second browser window, select your existing blog template and again go to Template>Edit HTML. Do NOT check the "expand widget templates box", as this will make things much easier for you. Now, locate the widget content identifiers in your template sidebar. Most likely, the section will look something like this: The code featured inside the red box displays the identifying code for your widgets, which calls the widgets to appear in your blog. You need to copy all of these <b:widget...> sections to yout clipboard, or paste into Notepad for easy editing in a few moments.
  5. Once you have copied the widget identifiers from your old template, go back to the browser window in which you can edit your new template.
  6. Find this section in your blog template:
    <div id='sidebar-wrapper'>
    <b:section class='sidebar' id='sidebar' preferred='yes'>
    There may or may not be content here... </b:section>
    </div>
    If there are any widgets defined here, it is advisable to delete them. Otherwise you may end up with duplicated widgets. Then in their place, paste the widget codes from your old template:
    <div id='sidebar-wrapper'>
    <b:section class='sidebar' id='sidebar' preferred='yes'>
    Paste the widget identifiers here </b:section>
    </div>


    If there are no widgets present in the sidebar of your new template, the code may look like this instead:
    <div id='sidebar-wrapper'>
    <b:section class='sidebar' id='sidebar' preferred='yes'/>
    </div>
    In this case, you should delete the trailing slash from the end of the line (highlighted in red). Make a line break then paste your widget content as before. Then finally create another line break and add the following line:
    </b:section>
    The finished result should look something like this:
  7. IMPORTANT! Do not preview your template at all during this process! If you do, you run the risk of duplicating the widgets which will cause you many problems. This seems to be a glitch on Blogger's behalf rather than an error of this method. In any case, do not preview the template.
  8. At this point, you should save the test blog template, after which you can view your blog in the normal manner. You will notice that no widget content is actually showing, only the widget titles. This is perfectly normal: as I mentioned earlier, the widget content is stored in the settings for your original blog.
  9. Okay, now we have copied over the widgets, we can download the XML template ready to transfer over to the original blog. To do this, go to Template>Edit HTML and select "Download full template" near the top of the page. Save the template to your computer with a name you can easily identify.
  10. Now back to the other browser window where you should have the Edit HTML page for your original blog still on the page. Here you should look for the "upload new template" section near the top of the page. Browse for the template you just downloaded from your test blog and upload it. You should NOT receive any error messages, like this: If you do see such error messages, take note of the widgets the template wants to delete, then choose to cancel the process. You should then copy the appropriate widgets from the old template into the new template in your test blog (as before), save the template and attempt to upload it again.
  11. If you receive no error messages, your template will be saved, and you can now view your new blog template with all your old widgets still in place. You can then move the widgets around however you wish in the Layouts section of your dashboard.

I hope this tutorial helps you easily copy your widgets from your old template to your new one. Please leave your comments and opinions below, and feel free to contact me if you have any problems doing this in your own blogs.

Technorati Tags: | | | >

28 Comments:

27 November 2007 09:02 Dremeber said...

Thx Amanda.
Should have discovered your blog much sooner. Will give it a try this week. Already did a test run on my test blog and your guide provid itself.

One step closer to my ultimate goal.

Cheers,
Dremeber

29 November 2007 09:56 Amanda said...

Hello Dremeber,

Thank you for dropping by! I'm glad this tutorial was useful to you, and hope you also find other useful tips on site.

Best wishes,
Amanda

7 December 2007 16:48 Herb said...

I've followed your instructions to the "T", yet I keep getting the same error message. i really don;t know what I'm missing, as your instructions are really simple and easy to follow. This is the error message i keep getting:

bX-a1yp
Additional information
blogID: 5153917164083405033
host: www.blogger.com
uri: /html

31 December 2007 19:34 Seine said...

super helpful, and easy to boot! i've seen several other blogs suggesting copying & pasting each individual widget into notepad (and c&p it back after the template change). this is so much better :) thanks so much!

23 February 2008 23:58 Mattheous said...

Would this work for transfering widgets to a Test Blog to create a template? Because it doesn't seem to work for me.

2 June 2008 07:06 A Library Girl said...

Thank you very much for writing this post! I just did my first template change to one of the templates you've got on your site (one of the 3-column Rounders ones), and I was able to do it without too much fuss. The only widget that wouldn't transfer over was the one for the bit of code that allows me to get Statcounter stats - I kept getting errors about improperly formed code or something like that whenever I tried to save the Test blog template, so I just abandoned that and added it back again when I made the change.

22 June 2008 14:36 Bill Kennedy, CA said...

Thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you and thanks again.

Bill
http://EnergizedAccounting.blogspot.com
Now serving you in 3 exciting columns

12 July 2008 09:03
Anonymous said...

Hi, Amanda. I'd changed my tamplate and a few of widget... dissapers (I don't sew your post before :$). In the Google cache I can get the source of the old template with the widgets. So, ¿it's possible take the div=widgets from the old code and save it on the new template? ¿Any other idea? I'd lost the widgets like a complet idiot.
Thank you in advance and best wishes.

Antonio

23 July 2008 10:49 Gene Netto said...

I got the widgets in place, but there is no content. Just the widgets titles. Shouldn't the content (links) be there as well? Or doesn't the process described above work for link lists?

26 July 2008 22:01 Credo said...

I used to copy the content/code of my widgets to notepad if I change my template and then re-built the widgets on the new template.. Works quite good for me. But I think your way is more elegant :)

1 September 2008 07:48 vijay said...

Thanks a lot. I used to loose many of my widget when ever i change my blog theme and stopped changing themes. Atlast got hold of good tip that actually works.

21 September 2008 09:57 jaycee said...

Thanks for this tutorial, I will now have an easier time managing my new layout. More so, it will give me an easier task rather than copy pasting all of the widgets again from scratch.

28 September 2008 14:02 Natural said...

works for me. just what i've been looking for. thanks!

11 October 2008 05:39 Barbara said...

I am about to switch my Domestic Violence Victim's information blog over to a new look and I have been pondering how to do just THIS!! I did another blog of mine and spent HOURS just switching things over.

Thank you - thank you - THANK YOU!!!

31 October 2008 13:14
hcfoo said...

Thank you for this tips! I used to face this problem which makes me think twice of changing into a better looking template. Not anymore ;)

30 November 2008 08:37 Ciput69 said...

Thanks a lot Amanda. This tips is very useful to me as I'm a new blogger. I hope I can learn more from your other posts here.

24 February 2009 19:11 chetan said...

thknzzz dearr..

u r gorgeous.. ..

thknzz for nice helping

27 March 2009 16:03 emiliethestrange said...

Hi. I read the instructions but on the instruction number 3 when I desselect "Expand Widget Templates". I was prompted that changes will be discarded.

28 March 2009 19:41 Recessionista! said...

There are no words for how much I appreciate you posting this tutorial. It SAVED me! Thank you so much!!

20 April 2009 08:56 ::Farina:: said...

I got the widgets in place, but there is no content. Just the widgets titles. Shouldn't the content (links) be there as well? can u pls help me

27 April 2009 17:57 reyvo said...

Its great template

16 July 2009 03:34 JennJ said...

Hi Amanda I used one of your templates as a guide for my first Blogger blog I have tried this to put breaks between my widgets but I still can't seem to get it to work I don't know what I'm doing wrong. :(

8 August 2009 14:41 vivapinay said...

thank you so much!

14 October 2009 01:45 Shoshana said...

I am trying to copy my widgets into your gourmet menu template but there does not appear to be code that matches exactly where you say to paste in the widget code. I keep trying to figure it out, but it isn't working. Can you tell me where I should place the widget code to make this template work? Thank you.

14 October 2009 01:48 Shoshana said...

I am following your article to copy widgets to use in your gourmet menu template but there doesn't appear to be code that matches where you say to post the widget code. I have tried several things that didn't work, can you give me some advice as to how to do this?

4 January 2010 12:12 jackie said...

Not easy though, but a BIG thank u to u. After several attempts, I made it.

Post a Comment

Browse through the Archives

All existing posts are still available to view while I'm working on the site, albeit seen in a much simpler interface. Feel free to browse through the archives to find tutorials, templates and articles to help you build a better blog:

Blog Archive

© Blogger Buster 2010 Home | About | Contact | Hire Me