17

When a person posts a link on Facebook, Facebook automatically finds a photo to be used as a thumbnail that shows up in the news feed. Is there some sort of (HTML) markup to surround a photo you'd like to use as the first choice?

juliocesar
  • 5,706
  • 8
  • 44
  • 63
user94154
  • 16,176
  • 20
  • 77
  • 116

3 Answers3

22

What you want are the <meta> tags that Facebook defines in their documentation on Facebook_Share/Specifying_Meta_Tags.

You don't put the metadata around the image itself, rather, you put it in the head of the document, like this:

<meta name="title" content="The Title Of The Link" />
<meta name="description" content="A description of the link would go here." /> 
<link rel="image_src" href="http://www.example.com/images/image.jpg" />
sakibmoon
  • 2,026
  • 3
  • 22
  • 32
artlung
  • 33,305
  • 16
  • 69
  • 121
  • If I want to share links dynamically (from database) how can I specify each one in head. – Jenz Oct 23 '13 at 04:34
1

The accepted answer is now out of date. The new way to do it is with an open graph tag e.g.

<meta property="og:image" content="http://example.com/picture.jpg" />
jackocnr
  • 17,068
  • 10
  • 54
  • 63
  • I used this meta property today and works fine. Some more details including the preview details is available: http://stackoverflow.com/a/18817334/281087 – Web_Developer Jun 17 '15 at 09:04
0

keep in mind that if everything doesn't work, than, may be, you should reload Facebook cache. http://developers.facebook.com/tools/lint/

wiifm
  • 3,787
  • 1
  • 21
  • 23
nikaan
  • 397
  • 1
  • 4
  • 10