1.在html tag內加入 xmlns:og、xmlns:fb屬性
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="http://www.facebook.com/2008/fbml">
2.head tag加入
<meta name="og:description" content="" />
<meta property="og:title" content=""/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="
"/>
<meta property="og:image" content="
"/> 縮圖, 可設定多圖
<meta property="og:site_name" content="" />
<meta property="fb:app_id" content="" />
<meta property="fb:admins" content=""/>
3.body tag裡面加入
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: '
app id', status: true, cookie: true, xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/zh_TW/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
4.清除facebook cache
https://developers.facebook.com/tools/debug
5.在要點擊分享的按鈕加上
<a href="https://www.facebook.com/sharer/sharer.php?u=url" target="_blank">分享到FACEBOOK</a>
或
<a target="_blank" onclick="return !window.open(this.href, 'Facebook', 'width=640,height=300')" href="http://www.facebook.com/sharer/sharer.php?u=url">分享到FACEBOOK</a>
補充
1.自動產生連結網站
http://www.sharelinkgenerator.com/