Facebook SDK 5帖子带有署名

时间:2017-04-07 16:50:05

标签: php facebook facebook-graph-api facebook-php-sdk

我已经让Facebook SDK自动将博客帖子发布到我的Facebook页面,但我似乎无法让帖子行/作者出现。

如果我直接将该网址分享到该网页,那么文章作者就会显示,但它并不适用于SDK。

文档显示了您可以发送的各种变量,但没有示例或更多信息。看起来很有希望的两个选项是admin_creatorfrom

admin_creator表示需要object[] idname,但没有示例说明将此内容传递给API的内容和方式。我尝试过的任何内容都不起作用(例如个人资料ID和个人资料名称),而我from尝试传递个人资料ID无效。

如果有人这样做你可以帮忙吗?谢谢!

SDK docs ref:https://developers.facebook.com/docs/graph-api/reference/v2.8/post/

手动共享:

Shared manually

通过SDK:

via SDK

1 个答案:

答案 0 :(得分:1)

Does the metatag "Author" exist in your articles? Try to use the Object Debugger (https://developers.facebook.com/tools/debug/og/object/) and check if the "Author"'s name comes out. If not, the first thing is to understand why it doesn't appear.

Option 1: you missed the metatag in your code.

<meta name="author" content="Your name">

You can also add these metatags. The first one explicit the object type (article) while the second one links the author's name to an URL (like your FB's profile page):

<meta property="og:type" content="article"/>
<meta property="article:author" content="yourlink.com"/>

Option 2: if you're already using all these metatags you may have some cache problem. Are you sure that the Facebook Spider's can read your metatags? Maybe are you exposing a version of the article that misses the metatags?