Twitter cards for blogspot users

I’ve previously written on implementing twitter cards on wordpress and in a comment on that post was asked if it could be achieved for blogger.

The answer is of course yes, and I found a number of articles claiming to achieve it, but none really seemed straightforward to me, so here’s my own recipe.

(To recap, a twitter card is a tweet with some extra bits on it. Like this one. This is a twitter card set up against a blogspot blog, using the instructions below.)

Header code.

You need to put some code in the header of your template.

I’ve put my snippet right before the closing tag.(click to see bigger)

editing template in blogger

My code looks like this:

Two points
1) Change the @YOURTWITTERNAMEHERE in this code to your own twitter name.
2) This code is relying on you having set a metaDescription on each post. You should be doing that for search engine friendliness reasons (I’m assuming you want to be friendly to search engines anyway.)

If you don’t have this switched on, this twitter card configuration won’t work.

Turning on metaDescriptions

To turn metaDescriptions ON you need to go to Settings> Search description and enable search descriptions.

enable search description

Then when you’re editing, fill it in on the left.

search description

Validate your new twitter card

After you’ve done all this, you’ll want to check that your card validates.

Go to the Twitter card validator on twitter itself and use the try card section. Or if you’re feeling brave, just skip to validate and apply – filling in the url of a post you’ve made that has a description and everything else.

Once you’re happy with how it validates, you have to apply to twitter for the code to actually work – in my experience this takes minutes. There are of course other twitter cards as well as summary cards, you’d have to tweak the code above if you want a different one, if you do that, please do let me know!

This entry was posted in Uncategorized on by .

About jax

With 8 years experience in programming, and 10 years experience in blogging, it was obvious that at some point I'd start a technology blog. This is my third attempt to keep it regularly updated!

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>