duanchuang1935 2014-11-17 11:27
浏览 129
已采纳

Facebook分享者应该从获取的URL中提取图像而不是从规范URL中提取图像?

Recently i have noticed that if someone shares my website URL in facebook sharer then it pulls images from canonical URL not from fetched URL that is happening because of i have added -

<meta property="og:url" content="http://www.mywebsite.com"/>
<meta property="og:description" content="description related to page/images">

but it is showing every time my home page's images not of fetched URL

my URL are looking like that-

canonical URL - http://www.mywebsite.com
fetched URL - http://www.mywebsite.com/tags/car

So i'm not getting any idea what do i do so facebook sharer always show my fetched URL's images.

I know this could be same question asked before like these-

Is it possible to extract metadata from fetched url instead of canonical url?

Canonical url being linked on Facebook rather than real URL. Dynamic OpenGraph tags coming up empty

but there is a same solution in both question that is -

I need to setup Intermediate URL redirection, so i just searched about the 301, and 302 redirection, but i'm not getting any idea how/where do i use it?

I need to do this for my wordpress and an other website(which is in zend framework).

Please tell me anything if anyone has did the same.

I will be grateful for Any help.

  • 写回答

2条回答 默认 最新

  • doujiao1905 2014-11-26 12:28
    关注

    The problem you are facing is, that you are sending your home url as a canonical url of the shared url. This is wrong as a canonical url has to point to a resource with the same content as the fetched url. For a definition of what canonical urls are check RFC6596 or a good description from Google.

    Pointing to the Index URL of you site, as you do, is not pointing to a canonical (equivalent) URL. By setting that URL you are saying to Facebook "You can go look there, you will find the same content as here. So just take everything from there." But I guess this is not what you intend.

    If you still want to point to you index (which imho is abusing the system), then you can try also adding the metadata for an image, which should result in the image you provide to be used to represent the link:

    <meta property="og:image" content="http://www.mywebsite.com/path/to/image.jpg" />
    

    The reason, why you shouldn't point to your index as canonical: If a user A wants to share some specific content, user B clicking on the link in facebook won't find the expected content, instead he'll see the index page and doesn't know which content user A wanted to share.

    The correct way to use the og:url meta, is to point to a real canonical (equivalent) URL which will show the smae content as the fetched URL. Often such a link is referred to as permalink. If you can't provide such an url just use the fetched url itself or leave it away. Pointing to the index is wrong.

    For wordpress there is a plugin, which should do this correctly. And the open graph protocol is documented here.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 删除虚拟显示器驱动 删除所有 Xorg 配置文件 删除显示器缓存文件 重启系统 可是依旧无法退出虚拟显示器
  • ¥15 vscode程序一直报同样的错,如何解决?
  • ¥15 关于使用unity中遇到的问题
  • ¥15 开放世界如何写线性关卡的用例(类似原神)
  • ¥15 关于并联谐振电磁感应加热
  • ¥60 请查询全国几个煤炭大省近十年的煤炭铁路及公路的货物周转量
  • ¥15 请帮我看看我这道c语言题到底漏了哪种情况吧!
  • ¥66 如何制作支付宝扫码跳转到发红包界面
  • ¥15 pnpm 下载element-plus
  • ¥15 解决编写PyDracula时遇到的问题