我正在使用Twitter Card Preview工具来测试我的 Twitter Card 设置。
<meta property="twitter:url" content="http://liberalgeek.com/content/why-do-atheists-celebrate-christmas" />
<meta property="twitter:card" content="summary" />
<meta property="twitter:description" content="I can't speak for all atheists, I can only speak for myself, so please leave a comment below and explain why you celebrate Christmas! When I hear someone ask, "Why do atheists celebrate Christmas?" my first thought often is: Better Question: Why do Christians celebrate Christmas?" />
<meta property="twitter:creator" content="@kennywyland" />
<meta property="twitter:title" content="Why do Atheists celebrate Christmas?" />
当我使用上述元标记时,预览工作,我得到了预期的结果。但是,当我尝试添加 twitter:image 标签时,它失败了。这是一个例子:
<meta property="twitter:image" content="http://liberalgeek.com/sites/default/files/styles/large/public/Christmas%20Tree.jpg" />
如果我包含一个 twitter:image 元标记并单击“预览”按钮,它会旋转一会儿,然后给我错误:
Looks like something is technically wrong.
Please try again in a few minutes.
我在该网站上尝试了其他图像,但没有成功。我已经尝试过托管在同一台 apache 服务器上的其他(非 drupal)站点,以确保它不是 drupal 问题:
<meta property="twitter:image" content="http://www.journalscape.com/kenny/images/acupuncture-kenny-2003-08-20-small.jpg" />
如果我将这些图像中的一个复制到具有不同 apache 服务器的不同机器上,twitter 会看到它并且它工作得很好。Twitter 在预览中显示它。
我已经在两个站点上检查了我的 robots.txt。我的 robots.txt 中的任何内容都不应阻止 Twitterbot 获取,但以防万一我明确添加了他们建议的代码:
User-agent: Twitterbot
Disallow:
但是,我正在看着我的 apache 网络日志滚动,而 Twitter 从未尝试获取图像。当我单击预览按钮时,我希望在访问日志中看到一个条目,显示 twitter 正在获取图像……但什么也没有。我已经尝试了几张图片以确保这不是缓存问题。
我究竟做错了什么?
编辑:我发现在我的机器上运行的一个站点(相同的 apache)工作得很好。如果我使用这张图片:
<meta property="twitter:image" content="http://www.geekqi.com/images/StylizedYinYangRedLucida.png" />
然后 twitter 立即获取它。我不明白为什么一个有效而另一个无效。