【问题标题】:Facebook like button on posts not working properly帖子上的 Facebook 点赞按钮无法正常工作
【发布时间】:2013-01-13 16:12:21
【问题描述】:

我是第一次使用开放图。在任何这样的网址中,您都可以在顶部看到该网站的 Facebook 页面的“赞”按钮,在文章的标题和摘要之后看到另一个“赞”按钮。第二个赞按钮未按要求工作。如果我从该链接中喜欢,那么网站的 Facebook 页面会被喜欢,而不是文章,而我想向其他看到类似帖子的 Facebook 用户显示的信息是文章的摘要,而是显示该人喜欢该页面懒惰的家伙。并且图像也没有显示我在打开图形标签中指定的内容。该网站仍然不完整。我现在已经试过很多次了。

Have a look at this page。中间的第二个赞按钮无法正常工作。

【问题讨论】:

    标签: facebook facebook-graph-api facebook-like facebook-javascript-sdk


    【解决方案1】:

    确保在代码中使用正确的 data-href 来点赞文章。 (您应该引用那篇文章的 URL,即使它位于包含多篇文章的页面上。)

    例如:

    <div class="fb-like"
         data-href="http://www.yoursite.net/articles/unique-article-id-goes-here-or-something-like-that"
         data-send="false"
         data-layout="button_count"
         data-width="140"
         data-show-faces="false"
         data-font="segoe ui"></div>
    

    Facebook 开发了一个方便的小工具来为您创建代码! 请务必查看the Facebook Developers page on like buttons

    如果正确完成,它应该从该链接获取 opengraph-data 并且将同​​时修复。

    您必须确保 og-data 设置正确。(位于 www.yoursite.net/articles/unique-article-id-goes-here-or-类似那个页面。)

    <meta property="og:title" content="Title of the article" />
    <meta property="og:type" content="article" />
    <meta property="og:url" content="same-url-as-the-data-href-from-like-button" />
    <meta property="og:image" content="url-to-image-you-would-like" />
    <meta property="og:site_name" content="Name of your site" /
    

    祝你好运!

    【讨论】:

    • 我添加了一个链接,指向我遇到此问题的网站页面。
    • 编辑了我的答案。请检查一下。您应该更改页面中的 og 信息。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-20
    相关资源
    最近更新 更多