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.)
From right now: Testing out twitter cards on blogspot http://t.co/xtY7aGgGqx
— Jax Blunt (@liveotherwise) September 6, 2013
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)
My code looks like this:
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.
Then when you’re editing, fill it in on the left.
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!