Keyword

og:image tag gives the wrong url when using CDN

  • Uzi
  • Uzi's Avatar Topic Author
  • Offline
  • Premium Member
More
2 weeks 53 minutes ago - 2 weeks 42 minutes ago #171426 by Uzi
Uzi created the topic: og:image tag gives the wrong url when using CDN
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: 2 weeks 42 minutes ago by Uzi.

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

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
1 week 6 days ago #171436 by Fotis
Fotis replied the 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

?>


If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

Moderators: william white