og:description not works

GK User
Tue Dec 25, 2012 1:21 pm
Hi,
I have a problem with open graph, in youtube the descripion of an article shows the css style not the real description. I attach a image.

description.png


How i fix this?
Thanks!!
User avatar
Fresh Boarder

GK User
Wed Dec 26, 2012 2:34 am
danibram wrote:Hi,
I have a problem with open graph, in youtube the descripion of an article shows the css style not the real description. I attach a image.

description.png


How i fix this?
Thanks!!


Hi,

The last time I had this problem I fixed it doing the following:

Check out this file: /components/com_k2/views/item/view.html.php

Look for these lines (around line 366):

Code: Select all
        // Set metadata
        if ($item->metadesc)
        {
            $document->setDescription($item->metadesc);
        }
        else
        {
            $metaDescItem = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->introtext.' '.$item->fulltext);
            $metaDescItem = htmlspecialchars($metaDescItem, ENT_QUOTES, 'UTF-8');
            $metaDescItem = K2HelperUtilities::characterLimit($metaDescItem, $params->get('metaDescLimit', 150));
            $document->setDescription($metaDescItem);


If you do have the exact same lines, change them to:

Code: Select all
// Set metadata
      if ($item->metadesc) {
         $document->setDescription($item->metadesc);
      }
      else {
         $metaDescItem = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->introtext.' '.$item->fulltext);
         $metaDescItem = K2HelperUtilities::characterLimit($metaDescItem, $params->get('metaDescLimit', 150));
         $metaDescItem = htmlspecialchars($metaDescItem, ENT_QUOTES, 'UTF-8');
         $document->setDescription($metaDescItem);


This is how I got it fixed :)
User avatar
Senior Boarder

GK User
Wed Dec 26, 2012 7:15 am
Thanks a lot!!
It works!! :side:
User avatar
Fresh Boarder

GK User
Wed Dec 26, 2012 9:45 am
Glad I could help :-)
User avatar
Senior Boarder


cron