opengraph - How does Facebook Sharer select Images and other metadata when sharing my URL? -


when using facebook sharer, facebook offer user option of using 1 of few images pulled source preview link. how these images selected, , how can ensure particular image on page always included in list?

how tell facebook image use when page gets shared?

facebook has set of open-graph meta tags looks @ decide image show.

the keys 1 facebook image are:

<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/> <meta property="og:image:secure_url" content="https://secure.example.com/ogp.jpg" /> 

and should present inside <head></head> tag @ top of page.

if these tags not present, older method of specifying image: <link rel="image_src" href="/myimage.jpg"/>. if neither present, facebook @ content of page , choose images page meet share image criteria: image must @ least 200px 200px, have maximum aspect ratio of 3:1, , in png, jpeg or gif format.

can specify multiple images allow user select image?

yes, need add multiple image meta tags in order want them appear in. user presented image selector dialog:
facebook image selector

i specified appropriate image meta tags. why isn't facebook accepting changes?

once url has been shared, facebook's crawler, has user agent of facebookexternalhit/1.1 (+https://www.facebook.com/externalhit_uatext.php), access page , cache meta information. force facebook servers clear cache, use facebook url debugger / linter tool launched in june 2010 refresh cache , troubleshoot meta tag issues on page.

also, images on page must publicly accessible facebook crawler. should specify absolute url's http://example.com/yourimage.jpg instead of /yourimage.jpg.

can update these meta tags client side code javascript or jquery? no. search engine crawlers, facebook scraper not execute scripts whatever meta tags present when page downloaded meta tags used image selection.

adding these tags causes page no longer validate. how can fix this?

you can add necessary facebook namespaces tag , page should pass validation:

<html xmlns="http://www.w3.org/1999/xhtml"       xmlns:og="http://ogp.me/ns#"       xmlns:fb="https://www.facebook.com/2008/fbml">   

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -