facebook|Twitter|linkedin分享

<!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
	<meta charset="UTF-8">
	<title>Document</title>

	<!-- facebook、linked参数配置 start -->
	<meta property="og:site_name" content="site name"/>
	<meta property="og:title" content="title"/>
	<meta property="og:type" content="website"/>
	<meta property="og:description" content="description"/>
	<meta property="og:image" content="http://www.ptengine.jp/images/hatenablog.png"/>
	<meta property="og:url" content="http://tztest4.ptmind.cn/test.htm">
	<!-- facebook、linked参数配置 end -->
	
	<!-- Twitter参数配置 start -->
	<meta name="twitter:card" content="http://www.ptengine.jp/images/logo_fb.jpg">
	<meta name="twitter:site" content="@ptengine">
	<meta name="twitter:title" content="test title">
	<meta name="twitter:description" content="Up than 200 characters.">
	<meta name="twitter:creator" content="@creator_username">
	<meta name="twitter:image:src" content="http://www.ptengine.jp/images/logo_fb.jpg">
	<meta name="twitter:domain" content="tztest4.cn">
	<!-- Twitter参数配置 end -->

</head>
<body>
	<!-- facebook分享 start -->
	<script>
		function fbs_click(){
			window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent('http://tztest4.ptmind.cn/test.htm?facebook=123'),'facebook share','toolbar=0,status=0,width=626,height=436');
			return false;
		}
	</script>
	<a onclick="return fbs_click()" target="_blank">
		<img src="ADD_IMAGE_URL_HERE" alt="Share on Facebook" />
	</a>
	<!-- facebook分享 end -->
	
	<!-- Twitter分享 start -->
	<script>
		function twitter_click(){
			window.open('https://twitter.com/intent/tweet?hashtags=Invitedusers&original_referer=http://tztest4.ptmind.cn/test.htm&related=Ptmind&text=Ptengine Test&tw_p=tweetbutton&url='+encodeURIComponent('http://tztest4.ptmind.cn/test.htm?twitter=123')+'&via=ptmind_ligang','share','toolbar=0,status=0,width=626,height=436');
			return false;
		}
	</script>
	<a onclick="return twitter_click()" target="_blank">
		<img src="ADD_IMAGE_URL_HERE" alt="Share on Twitter">
	</a>
	<!-- Twitter分享 end -->


	<!-- Linkedin分享 start-->
	<script>
		function linkedin_click(){
			window.open('https://www.linkedin.com/cws/share?url='+encodeURIComponent('http://tztest4.ptmind.cn/test.htm?linkedin=123')+'&token=&isFramed=false&lang=en_US','Linkedin share','toolbar=0,status=0,width=626,height=436');
			return false;
		}
	</script>
	<a onclick="return linkedin_click();" target="_blank">
		<img src="ADD_IMAGE_URL_HERE" alt="Share on Linkedin">
	</a>
	<!-- Linkedin分享 end-->


	<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
  	<script type="in/share" data-url="http://tztest4.ptmind.cn/test.htm" data-counter="top"></script>

</body>
</html>

注意问题:
1. facebook和linkedin对于"sample open graph meta tags"的要求格式一样,所以如果同一个页面既要做facebook又要做linkedin,对于图片等信息必须一致
2. linkedin具有七天缓存期限,官方原文“The first time that LinkedIn's crawlers visit a webpage when asked to share content via a URL, the data it finds (Open Graph values or our own analysis) will be cached for a period of approximately 7 days.”

开发文档
facebook:https://developers.facebook.com/docs?locale=zh_CN
Twitter:https://dev.twitter.com/web/embedded-tweets

linked:https://developer.linkedin.com/docs


你可能感兴趣的:(twitter分享,linkedi分享,facebook分享)