Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Com_k2 default open graph fix
//Go to(windows style path) joomla root/components/com_k2/views/item/view.html.php
// and comment line from 445 to 455
/*
$document->setMetaData('og:url', $uri->toString());
$document->setMetaData('og:title', htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8'));
$document->setMetaData('og:type', 'Article');
$facebookImage = 'image'.$params->get('facebookImage', 'Small');
if ($item->$facebookImage && JFile::exists(JPATH_SITE.$item->$facebookImage))
{
$image = substr(JURI::root(), 0, -1).str_replace(JURI::root(true), '', $item->$facebookImage);
$document->setMetaData('og:image', $image);
$document->setMetaData('image', $image);
}
$document->setMetaData('og:description', htmlspecialchars(strip_tags($document->getDescription()), ENT_QUOTES, 'UTF-8'));
*/
For joomla root/components/com_k2/views/latest​/view.html.php
comment line from line 256 - 261
// Set Facebook meta data
/*
$document = JFactory::getDocument();
$uri = JURI::getInstance();
$document->setMetaData('og:url', $uri->toString());
$document->setMetaData('og:title', (K2_JVERSION == '15') ? htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8') : $document->getTitle());
$document->setMetaData('og:type', 'website');
$document->setMetaData('og:description', strip_tags($document->getDescription()));
*/
For joomla root/components/com_k2/views/itemlist/view.html.php line 690 to 701
// Set Facebook meta data
/*
$document = JFactory::getDocument();
$uri = JURI::getInstance();
$document->setMetaData('og:url', $uri->toString());
$document->setMetaData('og:title', (K2_JVERSION == '15') ? htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8') : $document->getTitle());
$document->setMetaData('og:type', 'website');
if ($task == 'category' && $this->category->image && strpos($this->category->image, 'placeholder/category.png') === false)
{
$image = substr(JURI::root(), 0, -1).str_replace(JURI::root(true), '', $this->category->image);
$document->setMetaData('og:image', $image);
$document->setMetaData('image', $image);
}
$document->setMetaData('og:description', strip_tags($document->getDescription()));
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment