【问题标题】:Using Google Cloud Storage's public URL in Facebook `og:image` tags在 Facebook `og:image` 标签中使用 Google Cloud Storage 的公共 URL
【发布时间】:2019-02-11 02:57:34
【问题描述】:

我正在使用 Google Cloud Storage 来存储我网站的图片,包括页面的主图片。现在,当我在og:image 标签中使用该图片的 GCS URL 时,Facebook 不会在链接预览中显示该图片。

快速检查 Facebook 的共享调试器会返回此错误:

Invalid content type: https://storage.googleapis.com/moonhope-174701.appspot.com/1548993318172Suasana%20RM%20-%20Kartika%20Abrindah%20Ngantung.jpg ould not be processed as an image because it has an invalid content type.

这是分享它的页面的 URL。注意可能与og:url的内容不同

https://amborjo.com/restaurants/rm-syully-wakeke-f91e076125d411e991cc6db964093b53

我网站中的图片是使用 @google-cloud/storage Node.js 模块上传到 GCS 的,并且已经设置了 contentType 元数据。

如何解决这个错误?

【问题讨论】:

  • 一个真实的例子会更好,这个虚构的链接很难帮助
  • @luschn 我已经更新了链接。
  • 您也可以添加共享网址吗,该图片在哪里使用?
  • @luschn 我已将页面的 URL 添加到问题中。
  • 为什么图片网址中有空格?永远不要那样做……这甚至可能是问题所在,谁知道呢。

标签: node.js google-cloud-storage facebook-opengraph facebook-share


【解决方案1】:

这是一个已知问题,没有简单的解决方案,在 Facebook、iMessage 和使用图像标签进行预览的各种其他服务中出现。

我发现解决此问题的最直接方法是将您的应用程序配置为提供来自 Google Cloud Storage 的图像。使用 node.js 的说明如下:

https://cloud.google.com/appengine/docs/standard/nodejs/using-cloud-storage

【讨论】:

    猜你喜欢
    • 2014-01-18
    • 2020-03-24
    • 2017-07-30
    • 1970-01-01
    • 1970-01-01
    • 2017-07-08
    • 1970-01-01
    • 2021-12-03
    • 1970-01-01
    相关资源
    最近更新 更多