Friday, June 20, 2014

Twitter Cards and Google Sites

For the past few weeks, I've been procrastinating remarkably effectively. I have a habit of putting aside time-sensitive work and focusing instead on some side-project. I find it an incredible way to avoid doing work that needs to be done, yet at the same time not feeling guilty for wasting lots of time. I suspect this is an explanation of why I have my own set of motion-controlled lights that are connected to my stereo...

Image: OpenClipArt.org
One of the side-projects that grabbed hold of my attention like a bulldog with a hamhock was the idea of getting Twitter cards set up with my website. For those of you who don't know, I'm very active on Twitter (I help moderate the #cdnedchat weekly chats, and I interact with educators from around the world).

The bad news is that, as of the time of writing, there is no way to edit the HTML header information in a Google site. And before I get blasted with comments saying that you can have a custom header no problem, please be aware: the header image and the header HTML are two separate and distinct parts of a website. Header image, no prob. Header code, no dice. Seems like Google wants to avoid me getting in there and breaking my website.
Image: OpenClipArt.org
However, there isn't the same restriction on a Blogger blog. And it just so happens that I use Blogger. Hooray! I found a very helpful post on how to integrate Twitter cards to your Blogger. And this is actually better than I had hoped: each blog post will get its own custom Twitter card, generated from images and search descriptions you include when you write them.

Image: Wikimedia Commons
I did, however, modify the code just a little bit. I wanted to make sure that the Twitter cards would work for all my posts, not just new ones where I've taken the time to enter a search description and proper images. A couple of statments added, and everything seems to work. Now to wait and see if Twitter thinks I did it right.