Facebook Open Graph, the required property 'og: title' of type 'string' was not provided

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:

  <!-- Facebook Open Graph --> <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; ?>..." /> <!-- End Facebook Open Graph --> 

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.

+6
source share
2 answers

You might want to disable any compression, such as GZIP compression in PHP. This helped me with a similar issue on the Joomla 3.3 website.

I had gzip compression and Facebook was not able to clear my site. Disabling GZIP compression solved this problem.

I still do not understand if this is a Joomla problem or a GZIP / PHP problem in general or a problem with a copy of facebook.

EDIT: with a stock promotion, Facebook only reads the first 40 thousand pages. When gzip is enabled, reading only the first 40k will give problems because it cannot unpack partial content.

The best solution would be to disable GZIP only for sites like Facebook, LinkedIn, etc.

You can use the small gzip plugin very friendly. Management: http://extensions.joomla.org/extensions/core-enhancements/performance/site-performance/27725

Or use this codee https://github.com/dgt41/ (zip xml and php file, and you can install it as a plugin)

Please note: if the JCH Optimize module is installed on your site, you need to disable the gzip compression offered by the plugin. All other options can remain enabled without any problems, including gzip Joomla's own compression.

Cheers, Teeuwis

+16
source

I found a solution to the problem in joomla 3 by modifying only 2 files from the joomla core, so you do not need to disable the GZIP option. It automatically shuts off only when it detects a facebook crawler.

https://github.com/dgt41/joomla-cms/commit/6eef42e50e3f3e4c78c93285de7f9ecfe8bbfbf5 and the plugin to solve the problem, but this one does not work fine for me.

https://github.com/dgt41/facebookfix/commit/e1d5aa3a1a94f7751d3b69db78ba1aa02dfc37c6

+1
source

Source: https://habr.com/ru/post/974098/


All Articles