I have a Joomla page (v3.2.4) where I put some dynamic Open Graph tags with PHP, for example:
PHP, before the tag:
$getcid = JRequest::getVar('id'); if(!isset($getcid)) { $title = "LIVA Kurser"; $description = "Danmarks største udbyder af kurser til såvel offentlige og erhverv samt private."; $image = "http://www.livakursertestsite.dk/images/liva-logo.jpg"; $type = "website"; } else { $db = JFactory::getDbo(); $user = JFactory::getUser(); $query = $db->getQuery(true); $ogquery = "SELECT DISTINCT * FROM jos_managecourse WHERE state = '1' AND id = '".$getcid."' LIMIT 1"; $db->setQuery($ogquery); $db->query(); $getcourse = $db->loadObjectList(); $description = substr(strip_tags($getcourse[0]->details), 0, 247); $title = $getcourse[0]->course_name; $description = preg_replace( "/\r|\n/", "", $description ); $description = str_replace( " ", " ", $description ); $image = JURI::root()."administrator/components/com_managecourse/images/".$getcourse[0]->image_url; $type = "article"; }
And in my tag, I have the following:
<meta property="fb:app_id" content="502033806595590" /> <meta property="og:site_name" content="LIVA Kurser" /> <meta property="og:type" content="<?php echo $type; ?>" /> <meta property="og:title" content="<?php echo $title; ?>" /> <meta property="og:url" content="<?php echo JURI::current(); ?>" /> <meta property="og:image" content="<?php echo $image; ?>" /> <meta property="og:description" content="<?php echo $description; ?>..." />
When I launch the page through the Facebook object debugger , I get the following two errors:
The object at the URL ' http://www.livakursertestsite.dk/kurser/babytegn-2 ' type 'website' is invalid because the required property 'og: title' of type 'string' was not provided.
And the second error:
Curl error: BAD_CONTENT_ENCODING Error processing unencoding content: invalid block type
I tried:
- Moving code below and above the title tag
- Moving it to the very top and bottom of the header, but does not work.
- Putting PHP code in the header, but still nothing.
You can see the site here: http://www.livakursertestsite.dk/kurser/babytegn-2
EDIT:
I removed the PHP code from the tags, so they are no longer dynamic, to make sure this was the reason, but it is not. Now the code is as follows:
<meta property="og:locale" content="da_DK" /> <meta property="og:type" content="website" /> <meta property="og:title" content="LIVA Kurser" /> <meta property="og:description" content="Beskrivelse..." /> <meta property="og:url" content="http://www.livakursertestsite.dk/kurser" /> <meta property="og:image" content="http://www.livakursertestsite.dk/images/liva-logo.jpg" /> <meta property="fb:app_id" content="502033806595590" /> <meta property="og:site_name" content="LIVA Kurser" />
I also tried:
And the Facebook debugger still can't get the data.
Edit # 2:
After @CBroe's comment, I fixed the page so that it could be checked, without errors, but still no luck.