Facebook“点赞” ExpressionEngine 条目中的按钮无法正常工作
我正在为客户网站(在 ExpressionEngine 中)构建新闻部分,他们要求每篇文章都有 Facebook 点赞按钮。于是我访问了 Facebook 的开发者网站,找到了让它运行所需的代码。
我遇到的问题是,如果我喜欢一篇文章,那么所有的文章都被喜欢了!我在 OpenGraph 元标记中使用我的 ee 标记作为标题和永久链接,但无济于事。
打开图形代码:
{exp:weblog:entries weblog="news" orderby="date" sort="desc" limit="1" disable="member_data|trackbacks"}
<meta property="og:title" content="{title}" />
<meta property="og:type" content="non_profit" />
<meta property="og:url" content="{title_permalink=news/article}" />
<meta property="og:image" content="http://dallascityhomes.net/_images/dch-logo-big.png" />
<meta property="og:site_name" content="Dallas City Homes" />
<meta property="fb:admins" content="--removed--" />
{/exp:weblog:entries}
实际按钮(它包含在 exp:weblog:entry 标记中):
<div>
<a href="http://twitter.com/share?text={title}" class="twitter-share-button">Tweet</a>
<fb:like href="{title_permalink=news/article}" layout="button_count" show_faces="false" width="80" font="arial"></fb:like>
</div>
当然还有 FB 之类的 JS 脚本,我移到了文档的底部:
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
以前有人遇到过这个吗?知道解决办法吗?
I am building a News section for a client website (in ExpressionEngine) and they have requested that each article have the Facebook like button. So I went to Facebook's developer site and found the necessary code to make it work.
The problem I have is that if I like one article, it counts that like for all of them! I'm using my ee tags for title and permalink in the OpenGraph meta tags, but to no avail.
Open graph code:
{exp:weblog:entries weblog="news" orderby="date" sort="desc" limit="1" disable="member_data|trackbacks"}
<meta property="og:title" content="{title}" />
<meta property="og:type" content="non_profit" />
<meta property="og:url" content="{title_permalink=news/article}" />
<meta property="og:image" content="http://dallascityhomes.net/_images/dch-logo-big.png" />
<meta property="og:site_name" content="Dallas City Homes" />
<meta property="fb:admins" content="--removed--" />
{/exp:weblog:entries}
The actual button (it is wrapped within a exp:weblog:entry tag):
<div>
<a href="http://twitter.com/share?text={title}" class="twitter-share-button">Tweet</a>
<fb:like href="{title_permalink=news/article}" layout="button_count" show_faces="false" width="80" font="arial"></fb:like>
</div>
And of course the JS script for FB like, I moved to the bottom of the doc:
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
Has anyone encountered this before? Know a solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您查看源代码时,fb:like 标记的 og:url 元属性和 href 属性是否显示正确?
Do the og:url meta property and the href property of the fb:like tag appear to be rendering correctly when you view source?