4

I using ShareThis module in a drupal7 website for a certain content type say 'news'. When a user hits a Facebook share button, the title and links are fetched correctly but the thumbnail image it chooses is wrong. I want my fbshare to pick my news image as its thumbnail image. Pls help.

thanks.

Update: i got it worked using MPD's comment. i explicitly added og:image in my header. Below is my code. Hope it helps someone.

$element = array(
            '#tag' => 'meta',
            '#attributes' => array(
                 "property" => "og:image",
                 "content" => $imagePath,
                  ),
            );
drupal_add_html_head($element,'fb_share_image');
  • when you say you added the above code to your header, which file is that specifically? – ibexy Jun 30 '17 at 9:11
5

Did you test the page with the Facebook Debugger? Remember that Facebook caches page info, so changes don't appear immediately. A side effect of the debugger is that it clears the cache when you test a URL, so changes get picked up.

If you wan to use a specific image, you need to be sure it explicitly has an og:image element in the header. I am pretty sure this is something that the Meta Tags module can do this for you.

  • thanks mpd for the Meta Tags link. it did add open graph meta tags for the title, and summary of the node, but not for the image. I think like you said i have to explicitly add og:image element in the header. – krishnan May 5 '12 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.