ブログに”いいね”ボタン ”ツイート”ボタン ”はてな”ボタンをつけるには?
このブログにも、いいねボタンやらツイートボタンやらを取りつけようと思いついた。とくに意味はない。 取りあえず、いいねボタンをつけるにはどうしたら良いのか?
このようなボタンだ。以下のようなコードをはさみこめばOKだ。赤字部分は自分のページのものになる。 コードは公式サイトで取得できる。
Facebook 公式サイト:http://developers.facebook.com/docs/reference/plugins/like/
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fchinese-homepage.com%2F &send=false&layout=button_count&width=110&show_faces=true&action=like &colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe>
はてなブックマーク 公式サイト:http://b.hatena.ne.jp/guide/bbutton
<a href="http://b.hatena.ne.jp/entry/https://chinese-homepage.com/" class="hatena-bookmark-button" data-hatena-bookmark-title="中国インターネット事情" data-hatena-bookmark-layout="standard" title="このエントリーをはてなブックマークに追加"><img src="http://b.st-hatena.com/images/entry-button/button-only.gif" alt="このエントリーをはてなブックマークに追加" width="20" height="20" style="border: none;" /></a><script type="text/javascript" src="http://b.st-hatena.com/js/bookmark_button.js" charset="utf-8" async="async"></script>
Twitter 公式サイト:http://twitter.com/about/resources/tweetbutton
<iframe allowtransparency="true" frameborder="0" scrolling="no" src="//platform.twitter.com/widgets/tweet_button.html" style="width:100px; height:20px;"></iframe>
これを見ると、Twitterのものだけが自動でサイトを認識してくれるようだ。他はURLが必要となっている。 このURLの部分、方法はいくらでもあるのだが面倒なので、これでいいや。