There was an error in this gadget

Friday, February 24, 2012

Showing tweets on Google Sites - via gadget hack

It's super-easy to cobble together arbitrary JavaScript gadgets in Sites now. 
  1. Create a text file "foo.xml" on your local computer. 
  2. Add some wrapper XML into that file that looks like:
    <?xml version="1.0" encoding="UTF-8" ?>
    <Module>
    <ModulePrefs title="Custom Gadget" />
    <Content type="html"><![CDATA[
    //your stuff goes here!
    ]]></Content>
    </Module>
  3. Replace the "//your stuff goes here" with the JavaScript you want.  In my case, I pulled the content from my Twitter gadget on this blog.
  4. In your Google Site, upload the file as an attachment.
  5. On the Sites page in which you want your gadget to show, create a new gadget from a URL, where the URL is the location of your file.  In other words, something like https://sites.google.com/a/domain.com/foo.xml
Done - works great!

If you're really clever you'll quickly discover that building an interface to allow you to customize that gadget is also super simple. 

But why bother if it's just for you?  Do the simplest thing that possibly works if you want to ship!

- Chris.

No comments:

Post a Comment