Keyword

og:image tag gives the wrong url when using CDN

  • Uzi
  • Uzi's Avatar Topic Author
  • Offline
  • Premium Member
More
5 years 8 months ago - 5 years 8 months ago #171426 by Uzi
Hello,

I make use of another server to serve my images. The problem now is that the og:image tag still serves the url from the website server, instead of the images webserver. Where do these og:tags get defined? Else I just want to manually change this to the images server.

EDIT: Ok so I changed the view.html.php to instead of JPATH root to the url from the images webserver. But that is not a very good sollution, is it possible to do this in the template files I have in my template? Or is there another way?
Last edit: 5 years 8 months ago by Uzi.

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

More
5 years 8 months ago #171436 by JoomlaWorks
Replied by JoomlaWorks on topic og:image tag gives the wrong url when using CDN
You can override these meta tags directly in your K2 template overrides.

E.g. in item.php you could do (at the very top of the file):
<?php
/**
 * @version    2.9.x
 * @package    K2
 * @author     JoomlaWorks https://www.joomlaworks.net
 * @copyright  Copyright (c) 2006 - 2019 JoomlaWorks Ltd. All rights reserved.
 * @license    GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
 */
// no direct access
defined('_JEXEC') or die;

$image = 'http(s)://OTHER_SERVER/media/k2/items/src/'.md5("Image".$this->item->id).'.jpg';
$document->setMetaData('og:image', $image);
$document->setMetaData('image', $image); // Generic meta

?>

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum