Facebook Open Graph API - og:被忽略的元标记

SDG*_*SDG 7 facebook facebook-like opengraph facebook-opengraph

我正在解决一个问题,其中页面标题和图像没有包含在Facebook喜欢的内容中.点击OG调试器后,看起来og:facebook上没有任何元标记被访问:

这里的调试器的链接 -它说这是推断og:urlog:title其中存在的页面属性.

作为测试的问题,我直接从开发人员文档中的示例复制元标记和HTML模式,我仍然得到相同的警告.

这是生成的head标记的HTML和开头:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>123-ABC Butterfly Fun Carpet 3'10" x 5'5" Rectangle</title>
<meta name="description" content="Transactiv Products" />
<meta name="title" content="Transactiv" />
<meta property="fb:app_id" content="289501899130" />
<meta property="og:site_name" content="Transactiv InRecv" />
<meta property="og:url" content="http://localhost:2609/Pages/ProductSummary.aspx?OrganizationProductID=617c54a0-189a-48af-9b5e-002148210208&StoreID=a1d6bc99-9a6a-4e46-bdb4-790be4e59bd4&ProductID=d6748a89-41f4-48aa-a1c1-5c28f87cc47f&PageName=MHMTest&PageID=236549899706529" />
<meta property="og:title" content="123-ABC Butterfly Fun Carpet 3'10" x 5'5" Rectangle" />
<meta property="og:type" content="website" />
<meta property="og:description" content="" />
<meta property="og:image" content="http://transactivazureprod.blob.core.windows.net/pictureblob/831a4d4a-dbe3-44f5-9ff8-12286cdc33f5" />
Run Code Online (Sandbox Code Playgroud)

有什么想法吗?

Jin*_*mcg 6

Facebook会在此处读取您可以输入网址的所有属性:https: //developers.facebook.com/tools/debug

Facebook将读取您指定的属性,但有时仅在所有4个都被指定(而不是空)时使用它们,而不仅仅是最后3个.

<meta property="og:url" content="YOUR_URL" />
<meta property="og:title" content="YOUR_TITLE" />
<meta property="og:description" content="YOUR_DESCRIPTION" />
<meta property="og:image" content="YOUR_IMAGE" />
Run Code Online (Sandbox Code Playgroud)


Rob*_*lin 5

明显的缺陷.你没有完全结束这个头衔.你"进去了

我建议str_replace('"', "''", $str)先做一个回声吧.

那是,

<meta property="og:title" content="123-ABC Butterfly Fun Carpet 3'10" x 5'5" Rectangle" />

<meta property="og:title" content="123-ABC Butterfly Fun Carpet 3'10'' x 5'5'' Rectangle" />

编辑:

您也可以考虑htmlentities($str, ENT_QUOTES)按照@TwoWholeWorms的建议,