add-gadget

Blogger: How to Keep Your Widgets When Changing to a Custom Blogger Template

For many Blogger users, changing templates is a regular occurrence.  Since my wife and began creating and publishing Blogger templates, we’ve noticed that a lot of people change their themes regularly.  The main difficulty with this habit involves keeping gadgets (also called widgets) that have been used to personalize a blog, such as Followers, Pictures, .  My wife recently designed a Blogger template for my sister-in-law to use on her recipe blog.  When my sister-in-law uploaded the new template, her blog list disappeared.  That scenario happens quite often, and it inspired this article.   Here’s a quick solution to allow you to change your Blogger template while retaining your gadgets.

 

 

Why Does a Custom Template Remove Gadgets Anyway?
When a Blogger Template is created, the designer decides what to include to create the overall look of the template, such as the images for the background, navigation, etc.  The template designer also determines which gadgets will be included using XML tags that look something like this:

 

<b:widget id=’Text1′ locked=’false’ title=’Our Story…’ type=’Text’/>

 

This tag inserts a block of text (the text for this tag is kept in the Blogger database) into a blog.  With the variety of Blogger gadgets that exist nowadays, it is very unlikely that a template designer’s choice of gadgets will exactly match what a blog user has set up on his or her blog.

 

When you change templates, Blogger looks at the gadget tags in your new template and compares them to the tags in your existing template.  If one of the gadget tags you have in your existing template does not have a matching tag in your new template, Blogger doesn’t know what to do with the data saved in its database for that gadget, because it doesn’t appear anywhere in the new template.  Instead of trying to guess how you want to merge the gadgets for the two templates, Blogger simply discards the data for the old gadget.  Once the data has been deleted by Blogger, you can’t get it back.  I’m sure there are a lot of bloggers out there who have found that out the hard way.

 

Keeping Your Gadgets When Changing Templates

Even if you’re unfamiliar with or intimidated by XML code, these instructions for keeping your Blogger gadgets are simple.  I’ll walk you through an example.

 

I actually have a practical example for a blog that I’m updating right now.  I need a new template for the blog I’m writing about building a successful online business.  When I initially set up the blog, I used the Dots template, one of Blogger’s default templates.  I created a section of text that I want to remain on the sidebar of my blog as an introduction to the blog.   The text section was created by adding a Gadget in the left sidebar of my Layout, as shown here:

When I added the text section to my Layout, Blogger created a gadget in my existing theme by adding this code to the template’s XML:

 

<b:widget id=’Text1′ locked=’false’ title=’Our Story…’ type=’Text’/>

 

I looked through my wife’s themes to find one that is better suited for my blog than “Dots”.  Since she doesn’t have a template yet specifically for ecommerce blogs, I’m going to settle for one of her football templates.  Business we built and which I’m blogging about involved selling sporting goods, and I’m a Florida State football fan, so an FSU football template makes good enough sense.

 

To change my blog template, I go to Layout->Edit HTML, and then browse to the football template that I want to use.


When I click the Upload button, I’m shown the following message about my widgets being in danger of deletion.


To solve this problem, I first click the Cancel button to prevent my widget from being nuked.  Now, I need to make a change to the template I’m uploading so that my old Text1 widget doesn’t disappear when I make the theme change.  I need to insert into the new template the tag that represents my cliffhanging widget so that it doesn’t fall into oblivion.

 

To find out exactly which tag(s) you need to copy from your existing template to preserve the widget(s) in danger of deletion, take note of which widgets were listed in the warning message.  Then uncheck the “Expand Widget Templates” checkbox (This box was automatically checked when you attempted to upload the new template).  Changing the widget representation back to the unexpanded version will allow you to find the tags for the widget(s) in danger of deletion.   Next, do a search of your template  code (use Ctrl-F in Windows) for each of the tags that was mentioned in the warning message.  In my example, I searched for “Text1”.  That search turned up this tag, which I showed previously:

 

<b:widget id=’Text1′ locked=’false’ title=’Our Story…’ type=’Text’/>

 

I found that this widget was located in a section with an id of “sidebar”.


To insert this tag into the new template, I first look for a “sidebar” section in the new template.  If I can’t find that particular section, I can still paste the tag into any section block inside of my new template.  If I upload the new template and find that the Text1 widget isn’t where I want it, I can drag and drop it to a different position inside the template from the Blogger Layout page.  Here’s a screenshot showing where I inserted the tag using my HTML editor.  You can use a simple text editor such as Notepad to accomplish this.

 

After you’ve inserted the tag(s) you want to preserve into your new template, you can now save the template file and try the upload again.  If you’ve made the widget changes correctly, you shouldn’t see a warning notice when you save the changed template.

I hope this helps you in your quest to keep your blog looking fresh while keeping your valuable widgets.  Feel free to provide feedback on whether this worked for you.

Leave a Reply

Your email address will not be published. Required fields are marked *