Not sure where is the "index.php", but normally this you can do it inside the article view. So, first, make a override to com_content/article.
Then you need the follow code:
Then you need the follow code:
Code:
use Joomla\CMS\Factory; // this one can be already in your overrideuse Joomla\CMS\Uri\Uri;$document = Factory::getApplication()->getDocument();$images = json_decode($this->item->images);$ogImg = !empty($images->image_fulltext) ? $images->image_fulltext : $images->image_intro;if ( !empty($ogImg) ) { $document->addCustomTag('<meta property="og:image" content="' . Uri::base() . $ogImg . '" />');}
Statistics: Posted by carlitorweb — Fri May 10, 2024 12:59 am