facebook share button with custom title, description, and image [duplicate]

荒凉一梦 提交于 2019-12-20 20:03:27

问题


Possible Duplicate:
How does Facebook Sharer select Images?

It looks like that the Facebook support custom title, description, and thumbnail in several ways.

So far, I have found two solutions.

  1. using meta tag

    [meta name="title" content="title" /]
    [meta name="description" content="description" /]
    
  2. using URL parameters.

    [a href='http://www.facebook.com/sharer.php?s=100&p[title]=WEB1CHANNEL&p[summary]=Web+Design+Company+in+Dubai.&p[url]=http://www.webchannel.ae&p[images][0]=http://qacode.com/test.jpg']asdfa[/a]
    

I really like solution #2, but it looks like it is not stable. Sometimes it works, sometimes it does not. Overall, it works anyway.

Is it okay to use solution #2? Is it going to be available in the future?


回答1:


  1. Use Open-Graph Meta Tags to let Facebook get the data you want when scraping the page.
  2. Facebook will not respect the parameters you pass to sharer.php instead it'll try to get the info from the page.
  3. The Like plugin is the way to go and if you really don't have a good reason to use sharer...don't use it!
  4. Check your URL against the Facebook Debbuger to better test your links.



回答2:


As for as I have seen solution number 2 is not stable. I have seen many problems related to solution 2 in facebook as well as in this forum too. I have personally experienced that it is better to use meta tags with xfbml version of fb:share.

<fb:share-button type="button_count" href="http://<?php echo($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);?>"></fb:share-button>
It doesn't stop working in my experience.

来源:https://stackoverflow.com/questions/5257075/facebook-share-button-with-custom-title-description-and-image

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!