In Facebook the drupal logo is shown, when somebody clicks on a Like-button on my drupal site. I uploaded a logo to my site, but the module seems to ignore it. How can I change the logo shown in Facebook?

Thanks for help. And for this very simple and efficient module!

Michael

Comments

jerdiggity’s picture

For that, you'd probably be best off manually changing your theme's page.tpl.php file... Ultimately you want it to go from this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

To this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta property="og:image" content="http://www.example.com/picture_to_show_up_on_Facebook.jpg" />

(And actually I don't think the second "xmlns" entry -- xmlns:fb="http://www.facebook.com/2008/fbml" -- is necessary, but that's how I set mine up...)

Hope that helps...

lavisrap’s picture

Status: Active » Fixed

Thanks a lot!!

Works fine.

xmlns:fb="http://www.facebook.com/2008/fbml" was already in the file.

Michael

jerdiggity’s picture

Good stuff. You're welcome!
:)

j

rizzo’s picture

I'm using a zen subtheme, trying to get this to work. I've edited both zen/page.tpl.php and templates/page.tpl.php to look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/">

<head>
  <title><?php print $head_title; ?></title>
  <?php print $head; ?>
  <?php print $styles; ?>
  <?php print $scripts; ?>
  <meta property="og:image" content="http://www.foo.com/sites/foo.com/files/logo.png" />
</head>

But it still posts the drupal logo. Any thoughts?

rizzo’s picture

Actually it seems like it is working now.

jerdiggity’s picture

Yeah sometimes the caches have to be cleared, cron and/or update.php has to run, etc., before Drupal will recognize the changes made. Also simply visiting yoursite.com/admin/build/themes/settings/your_theme will (I think) rebuild the theme registry, re-scanning the theme's files for any changes your site doesn't yet know about. Either way, glad it worked.

I should also note that xmlns:og="http://opengraphprotocol.org/schema/" can be replaced with xmlns:og="http://ogp.me/ns#", and in some cases it appears as though that's the preferred method of doing it (don't quote me on that one though).

j

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.