Displaying your Twitter tweets on your Google Sites website is difficult. Google Sites filters your HTML code and doesn't allow you to add your own JavaScript code. That means you can't add the many existing Twitter widgets that exist today, including Twitter's very own.
There's a Twitter gadget in the Google Gadget directory called "Twit". I was previously using it, but because it uses http
instead of https
and Google Sites uses https
, the latest version of Chrome would consider it as insecure content and not display it by default, instead asking the user if they want to display insecure content while recommending them not to. That's great if you want your visitors to think your site hosts malicious content and you don't want them reading your tweets.
So this was my solution, and hopefully it benefits others with the same problem:
- I haven't added this gadget to the Google Gadget Directory, so either host it yourself or (preferably) host it using the Google Gadget Editor (GGE).
- Using GGE, copy & paste the file twitter.xml (shown below) into the editor. Select
File
>Save As
and name ittwitter.xml
.
- Add the gadget to a page on your Google Site.
- Edit a page and click on the spot where you want to add the gadget
- Go to
Insert
>More gadgets...
>Add gadget by URL
- Paste the URL where your gadget is hosted. If you used GGE, copy the URL from the filename link in the upper right corner of the editor.
- Once it's added, go to the configuration settings (click on the gadget in edit mode then click on the cog icon).
- Modify the settings to your preferences, and don't forget to add your Twitter handle!
Notes:
- You can fork and customize the gadget if you like. For example, by default it shows your 12 latest tweets. If you want to change that number, search for 'rpp' and change the value.
- Thanks to the folks over at this discussion for doing most of the work!