OpenGraph linter 找不到 url 或无法读取元标记

发布于 2024-12-09 15:33:09 字数 1828 浏览 0 评论 0原文

我有一个奇怪的错误,有时 FB linter 抓取我的内容,但说它找不到元标记,而有时又说它根本找不到内容。

我检查了我的 apache 日志,FB 两次都正确地调用了我:

69.63.181.244 - - [12/Oct/2011:11:02:07 -0700] "GET /~gilles/www/gillesdevaux/outbox/248227866689405176 HTTP/1.1" 200 8339 "-" "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)"
69.63.181.244 - - [12/Oct/2011:11:02:09 -0700] "GET /~gilles/www/gillesdevaux/outbox/248158254941601902 HTTP/1.1" 200 8104 "-" "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)"

第一个 linter 说我错过了 og:* 属性,第二个 linter 说无法访问该页面。

以下是两个页面的 html 代码:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# mytest: http://ogp.me/ns/fb/mytest#">
<title>opengraph picture + link | Formspring</title>

<base href="https://testserver/~gilles/www/" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<meta name="description" content="opengraph picture + link" />
<meta name="keywords" content="" />
<meta property="fb:app_id" content="201652911907"/>
<meta property="og:title" content="opengraph picture + link"/>
<meta property="og:type" content="mytest:question"/>
<meta property="og:url" content="https://testserver/~gilles/www/gillesdevaux/outbox/248227866689405176"/>
<meta property="og:image" content="http://testserver/photos/20111011/n4e94d0e273403.jpg"/>
<meta property="mytest:link" content="http://en.wikipedia.org/wiki/Cheese"/>

已解决

FB 需要 ping 您提交到 linter(或图形 API)的 URL,但还需要 ping og:url 中提到的 URL。

我的开发设置有点奇怪,它受基本身份验证保护,并且 OpenGraph URL 在代理中列入白名单。使用我为 og:url 提交的相同 URL 解决了该问题。

I have this weird error where sometimes the FB linter grabs my content but says it can't find the meta tags while sometimes it says it can't find the content at all.

I checked my apache logs and FB calls me properly both time:

69.63.181.244 - - [12/Oct/2011:11:02:07 -0700] "GET /~gilles/www/gillesdevaux/outbox/248227866689405176 HTTP/1.1" 200 8339 "-" "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)"
69.63.181.244 - - [12/Oct/2011:11:02:09 -0700] "GET /~gilles/www/gillesdevaux/outbox/248158254941601902 HTTP/1.1" 200 8104 "-" "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)"

First one the linter says I miss og:* properties, the second one the linter says the page could not be reached.

Here is the html code for both pages:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# mytest: http://ogp.me/ns/fb/mytest#">
<title>opengraph picture + link | Formspring</title>

<base href="https://testserver/~gilles/www/" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<meta name="description" content="opengraph picture + link" />
<meta name="keywords" content="" />
<meta property="fb:app_id" content="201652911907"/>
<meta property="og:title" content="opengraph picture + link"/>
<meta property="og:type" content="mytest:question"/>
<meta property="og:url" content="https://testserver/~gilles/www/gillesdevaux/outbox/248227866689405176"/>
<meta property="og:image" content="http://testserver/photos/20111011/n4e94d0e273403.jpg"/>
<meta property="mytest:link" content="http://en.wikipedia.org/wiki/Cheese"/>

Solved

FB needs to ping the URL you submit to the linter (or to the graph API) but also needs to ping the URL mentioned in og:url.

My dev setup is a bit weird, it's basic auth protected and the OpenGraph URL are whitelisted in a proxy. Using the same URL I submit for og:url fixed the issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

平生欢 2024-12-16 15:33:09

将开放图谱协议命名空间属性添加到标签中:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" 
    lang="en" dir="ltr" xmlns:og="http://ogp.me/ns#">

add the Open Graph Protocol namespace attribute to the tag:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" 
    lang="en" dir="ltr" xmlns:og="http://ogp.me/ns#">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文