Twitter 元图像未在 Twitter 上呈现,因为它 "may be restricted by the site's robots.txt file"

Twitter meta image is not rendering on Twitter because it "may be restricted by the site's robots.txt file"

所以这是 link 当我尝试使用 Twitter 时图像不知何故不起作用,而它适用于 Facebook。

它仅适用于 Facebook,但对于 Twitter 我遇到了问题:

WARN: The image URL https://scontent.xx.fbcdn.net/v/t31.0-8/19388529_1922333018037676_3741053750453855177_o.jpg?_nc_cat=0&oh=ba7394f2a6af68cb4b78961759a154f1&oe=5B6BC349 specified by the 'twitter:image' metatag may be restricted by the site's robots.txt file, which will prevent Twitter from fetching it.

不知道是什么原因造成的,这是我的 robots.txt:

User-agent: *
Disallow: /translations
Disallow: /manage
Disallow: /ecommerce

这里是 link 来重现这个问题:https://invoker.pvdemo.com/album?album=1422199821384334&name=gallery

您的 robots.txt 仅与您的网址相关。对于托管在 https://scontent.xx.fbcdn.net/ 的图像,相关的 robots.txt 是 https://scontent.xx.fbcdn.net/robots.txt

目前,这个 robots.txt 阻止一切:

User-agent: *
Disallow: /

URL Crawling & Caching 中所述,Twitter 的爬虫 (Twitterbot) 尊重 robots.txt:

If an image URL is blocked, no thumbnail or photo will be shown.

您还可以将 robots.txt 配置为对不同的抓取工具具有显式权限:

User-agent: facebookexternalhit
Disallow:

User-agent: Twitterbot
Disallow:

Google 这里有关于它的很棒的文档: https://developers.google.com/search/docs/advanced/robots/create-robots-txt

https://gist.github.com/peterdalle/302303fb67c2bb73a9a09df78c59ba1d