https://developers.facebook.com/docs/plugins/like-button
<html>
<head>
<title>Your Website Title</title>
<!-- You can use open graph tags to customize link previews.
Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
<meta property="og:url" content="http://www.your-domain.com/your-page.html" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Your Website Title" />
<meta property="og:description" content="Your description" />
<meta property="og:image" content="http://www.your-domain.com/path/image.jpg" />
</head>
<body>
<!-- Load Facebook SDK for JavaScript -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- Your like button code -->
<div class="fb-like"
data-href="http://www.your-domain.com/your-page.html"
data-layout="standard"
data-action="like"
data-show-faces="true">
</div>
</body>
</html>
在我们的例子中,页面有一个产品列表,每个产品都应该有自己的Like按钮。
Product 1: Like Share
Product 2: Like Share
Product 3: Like Share
Product 4: Like Share
Product 5: Like Share
Product 6: Like Share
如何实现这一目标?如果页面有一个产品,我们可以使用meta og:xxx。
当用户点击产品的“赞”按钮时,有没有办法动态分配元属性?感谢。