Facebook sharer should pull images from fetched URL not from canonical URL?

1.5k views Asked by At

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

There are 2 answers

0
JHoffmann On BEST ANSWER

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.

0
Romisha Aggarwal On

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.