Keyword

K2 2.5.7.1 and wrong image with share on facebook

  • Andrew Billy
  • Andrew Billy's Avatar Topic Author
  • Offline
  • New Member
More
11 years 11 months ago - 11 years 11 months ago #105474 by Andrew Billy
We're having an issue with K2 2.5.7.1 and sharing items on facebook.

We're very wary of upgrading to K2 2.6.1 dues to compatibility issues we had on other sites and the fact that we use appx 7 custom item.php templates.

I've added to one template for testing. For whatever reason, when you like and share on facebook, the image that is being used is from modules/mod_news_pro_gk4/cache and may or may not even exist.
This is even with<meta property="og:image" set to the proper image.

I attached a screenshot . The left side shows url of the article image and the url in the og:image tag

The right side shows when when liking the article with the arrow pointing to the URL from the add a comment popup.

Notice the different url's.

Thanks for any assistance.
<?php
        $fbog =& JFactory::getDocument();
        $opengraph_meta = '
        <meta property="og:title" content="'.$this->item->title.'"/>
        <meta property="og:type" content="blog"/>
        <meta property="og:url" content="'.JURI::getInstance()->toString().'"/>
        <meta property="og:site_name" content="Oklahoma Welcome"/>
        <meta property="fb:app_id" content="redactedapp id"/>
        ';
        if (!empty($this->item->image)) {
            $opengraph_meta .= '<meta property="og:image" content="'.JURI::base().''.$this->item->image.'"/>';
        }
        else {
            $opengraph_meta .= '<meta property="og:image" content="http://oklahomawelcome.com/images/no_image.png" />';
        }
        $fbog->addCustomTag( $opengraph_meta );
?>
***EDIT***
Forgot to mention this is Joomla 2.5.7 and on oklahomawelcome.com
Attachments:

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum