Hi,
I was wondering how to successfully ensure that an image and description are pulled up when a node is posted to facebook? i found a few posts on the subject but no solution other than what I've posted below http://drupal.org/node/363679#comment-1461762, which i' not sure how to implement.
Basic Tags
In order to make sure that the preview is always correctly populated, you should add the tags shown below to your html. An example news story could have the following:
As shown, title contains the preview title, description contains the preview summary and image_src contains the preview image. Please make sure that none of the content fields contain any html markup because it will be stripped out. For consistency's sake, please use the tag to provide text data for the preview, and the tag for any source urls.
The title and summary tags are the minimum requirements for any preview, so make sure to include these two.
Is anyone successfully sharing items from their website with a description and image?
Hope all is well,
Evelyn
Comments
Comment #1
willsteinmetz commentedThat is something that would have to be included in the theme code, not the module. Please adjust your theme accordingly to follow the fix that you mentioned in the post link about.
Comment #2
nyleve101 commentedThank you!
In case any one else needs the code, the code below allows you to successfully share with facebook, just insert it at the top of your relevant node template files.
Code provided by Divesh Kumar:
Hope all is well!
Evelyn
Comment #3
willsteinmetz commentedComment #4
rimu commenteddrupal_set_html_head("<meta name=\"description\" content =\"" . strtr(substr(trim(strip_tags($node->content['body']['#value'])),0,200), array("\n" => " ", "\"" => "'", "‘" => "'", "’" => "'", "“" => "'", "”" => "'")) . "...\" />");worked better for me