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

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.

图片转代码服务由CSDN问答提供 功能建议

最近我注意到,如果有人在facebook sharer中共享我的网站网址,那么它会从规范网址中提取图片而不是从提取的网址中提取图片 由于我已添加 -

 &lt; meta property =“og:url”content =“http://www.mywebsite.com”/&gt;而发生的网址 
&lt; meta property =“og:description”content =“与页面/图像相关的描述”&gt; 
   
 
 

但每次我的主页图像都会显示 不是提取的网址

我的网址看起来像那样 -

 规范网址 -  http://www.mywebsite.com 
fetched  URL  -  http://www.mywebsite.com/tags/car
nn

所以我不知道我该怎么做所以facebook sharer总是显示我的 获取了URL的图像。

我知道这可能与之前提出的问题相同 -

是p 可以从获取的网址而不是规范网址中提取元数据吗?

Canonical url在Facebook而不是真实URL上​​链接。 动态OpenGraph标签空了

但是这两个问题都有相同的解决方案 -

我需要设置中间URL 重定向,所以我只是搜索301和302重定向,但我不知道我如何/在哪里使用它?

我需要为我的wordpress和 另一个网站(在zend框架中)。

如果有人做过同样的事,请告诉我任何事情。

我将感激任何人 帮助。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

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.

    点赞 打赏 评论
  • douza9835 2014-11-27 06:34

    Facebook uses og:url tag to consolidate the like and share count. Whatever url you will mention in og:url, facebook will share that url and increase the share count for that url. Otherwise, your likes and shares will be distributed among canonical urls.

    <meta property="og:url" content="http://www.mywebsite.com"/>
    

    If you set a og:image tag, then facebook sharer will pick that image. But make sure the image is of correct dimensions. Facebook check the dimension as well. I always use 600X315. Check image sizes here.

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

    Once you are done don't forget to clear the cache. Put your URL here

    Fetch new scrape information to see the changes.

    Meta tags like keyword, title and descriptions are used by search engines. og tags are used by facebook. and canonical urls are by rel="canonical"

    For any url, whatever data you want Facebook to fetch, needs to be set in og tags.

    And then debug the URL to see the new scrape information to see the changes.

    点赞 打赏 评论

相关推荐 更多相似问题