facebook share button with custom title, descripti

2019-03-18 12:36发布

问题:

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.