Saturday, August 14, 2010

How to add official tweet button on each blogspot posts

In yesterday, Official tweet button has been released. But, as out-of-box, this is not optimized for each blog posts like facebook's like button I wrote in phosphorescence: How to add facebook like button on each blogspot post. So I do the "try and error" to customize tweet button for each blogspot post, then I found the approach with referring official tweet button API page.
  1. [Layout] -> [Edit HTML]
  2. Turn on the checkbox "Expand widget templates"
  3. Into the tag of class='post-header-line-n' or class='post-footer-line-n', put the snipet like below:
    <a class='twitter-share-button' data-count='horizontal' data-via='your_twitter_name' expr:data-text='data:post.title' expr:data-url='data:post.url' href='http://twitter.com/share'>Tweet</a>
    <script src='http://platform.twitter.com/widgets.js' type='text/javascript'/>

We need to take care of containing ' in title. If contained, page title is omitted after '. So we should check all page titles and convert from ' to &apos;.

No comments:

Post a Comment