問題描述
試圖跟隨這個問題:Provide a picture for whatsapp link sharing
我建立了一個簡單的 HTML 網頁與基本的 Facebook 元標籤:
<!--FACEBOOK-->
<meta property="og:title" content="San Roque 2014 Pollos" />
<meta property="og:description" content="Programa de fiestas />
<meta property="og:image" content="http://pollosweb.wesped.es/programa_pollos/play.png" />
Facebook linter 驗證正確,在 Facebook 中顯示完美,但是當我嘗試透過 WhatsApp 分享影像時不會顯示。
我正在 Android 上的 WhatsApp 上嘗試
→This is the URL of the Sample Webpage
最佳解決方法
我相信您需要將 itemprop
新增到 og:image
元標記中,將影像大小設定為 256x256
,並且不會對 site_name
,type
和 updated_time
屬性新增任何影響:)
<meta property="og:site_name" content="San Roque 2014 Pollos">
<meta property="og:title" content="San Roque 2014 Pollos" />
<meta property="og:description" content="Programa de fiestas" />
<meta property="og:image" itemprop="image" content="http://pollosweb.wesped.es/programa_pollos/play.png">
<meta property="og:type" content="website" />
<meta property="og:updated_time" content="1440432930" />
您可以在 Google Maps 上檢視這些元標記。更改元標記後,您可能需要等待一段時間才能更新快取。
您可以從 Facebook Debugger 除錯/驗證 Open Graph 元標記如果您可以看到所有標籤,那麼標籤無法正確顯示的網站/應用可能對 Open Graph 標籤有不同的要求。
編輯:如果要透過 HTTP-Secure
連結指定影像,則需要使用 og:image:secure_url
而不是 og:image
。
EDIT2:您還需要指定 og:type
,因為它是四個基本必需引數之一。 <meta property="og:type" content="website" />
應該讓你走向正確的方向。
次佳解決方法
我在這裡找到了解決方案 Whatsapp preview link posted on 2 March 16
你應該看到工作 Before and after screenshoot
有兩種程式碼。第一個元 og:< head> 內的影像
<meta property="og:image" content="url_image">
來自 schema.org 中的< body> 中的縮圖架構
<link itemprop="thumbnailUrl" href="url_image">
<span itemprop="thumbnail" itemscope itemtype="http://schema.org/ImageObject">
<link itemprop="url" href="url_image">
</span>
希望這個幫助。謝謝。
第三種解決方法
我有同樣的問題,問題是圖片的大小。 Whatsapp 不支援大小大於 300KB 的圖片。
所以在 Whatsapp 上顯示影像的最重要的屬性是:
<meta property="og:image" content="url_image">
而要顯示的影像的大小必須小於 300KB
參考文獻
注:本文內容整合自 Google/Baidu/Bing 輔助翻譯的英文資料結果。如果您對結果不滿意,可以加入我們改善翻譯效果:薇曉朵技術論壇。