【问题标题】:How to fixed 'Unable to render Card preview' twitter error?如何修复“无法呈现卡片预览”推特错误?
【发布时间】:2017-07-26 10:50:44
【问题描述】:

我正在尝试在我的网站上实现 twitter 分享。为此,我添加了这些元标记:

<meta property="twitter:card" content="summary_large_image"/>
<meta property="twitter:site" content="@abc"/>
<meta property="twitter:title" content="dummy text"/>
<meta property="twitter:description" content="dummy text"/>
<meta property="twitter:url" content="http://example.com/example"/>
<meta property="twitter:image:src" content="http://example.com/wp-content/uploads/2017/03/example.jpg"/>
<meta property="twitter:domain" content="The Example"/>

当我尝试使用 twitter 卡验证器检查卡预览时。我收到此错误:错误:获取页面失败,因为它被 robots.txt 拒绝。

为了解决这个问题。我在服务器上的机器人文件中添加了这些行:

User-Agent: google
User-Agent: googlebot
User-agent: Twitterbot
Crawl-delay: 10 

User-agent: *
Disallow: /

但我仍然遇到这个问题。请帮我解决这个问题。

【问题讨论】:

  • 我认为有一个拼写错误,应该是User-Agent: Twitterbot 而不是User-agent: Twitterbot
  • 可能是我对这一切不太熟悉,但尝试不同的选项会有明显的危害,只需将其替换为User-Agent: Twitterbot,看看你是否有运气。

标签: php wordpress twitter twitter-card


【解决方案1】:

我从未见过 robots.txt 错误。

尝试添加&lt;meta name="twitter:creator" content="@abc"&gt;

FWIW 我不在图片上使用src

试试 &lt;meta property="twitter:image" content="http://example.com/wp-content/uploads/2017/03/example.jpg"/&gt;

【讨论】:

  • 您确定除非您是创作者否则无法预览吗?我觉得我已经看到了我发布到许多网站的链接的预览......
  • 我的网站在添加 twitter:creator 元之前有 twitter 卡片。今天,它停止工作,我添加了这个元,但没有任何改变。这是wordpress yoast seo 支持的网页
  • @AlexMorris 你是对的。 Twitter Card Validator 现在可以与任何链接一起使用。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-08-03
  • 2019-06-10
  • 1970-01-01
  • 2021-07-06
相关资源
最近更新 更多