为github.io托管网站指定facebook图像

问题描述 投票:0回答:2

使用这个question的答案,我已经实现了以下方法来指定要在Facebook上显示带有链接的图像,但它没有出现:

<head>
<meta property="og:image" content="lib/divvy.png">
<link rel="image_src" href="lib/divvy.png">
</head>

有没有理由说这不适用于github托管网站(或.png文件)?这是我要分享的页面:

http://mkfreeman.github.io/divvy/

html facebook image hyperlink
2个回答
1
投票

您必须指定图像的绝对路径。当图像的url路径将在浏览器而不是github blob对象上显示为图像时,您将知道它是否有效。

https://github.com/mkfreeman/divvy/blob/master/lib/divvy.png

我从迈克的实施中找到了答案。

http://mfviz.com/divvy/lib/divvy.png

2
投票

您可以使用Open Graph Debugger:

https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fmkfreeman.github.io%2Fdivvy%2F

它返回:

Open Graph Warnings That Should Be Fixed  
Inferred Property   The 'og:url' property should be explicitly provided, even if a value can be inferred from other tags. 
Inferred Property   The 'og:title' property should be explicitly provided, even if a value can be inferred from other tags.

另请参阅FB中关于Open Graph共享和优化分发的提示:https://developers.facebook.com/docs/opengraph/howtos/maximizing-distribution-media-content#tags

© www.soinside.com 2019 - 2024. All rights reserved.