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

前端 未结 12 1996
忘掉有多难
忘掉有多难 2020-11-21 04:20

When using Facebook Sharer, Facebook will offer the user the option of using 1 of a few images pulled from the source as a preview for their link. How are these images selec

12条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-11-21 05:14

    As of 2013, if you're using facebook.com/sharer.php (PHP) you can simply make any button/link like:

    share on facebook
    

    Link query parameters:

    p[title] = Define a page title
    p[summary] = An URL description, most likely describing the contents of the page
    p[url] = The absolute URL for the page you're sharing 
    p[images][0] = The URL of the thumbnail image to be used as post thumbnail on facebook
    

    It's plain simple: you do not need any js or other settings. Is just an HTML raw link. Style the A tag in any way you want to.

提交回复
热议问题