Hello,
I want to inject a prefetch image link into the header for webpage speed optimization.
Eg:
<link href="example.com/example.jpg" rel="prefetch" as="image" />
I have tried the below code into item view using template override:
<?php
defined('_JEXEC') or die;
// Prefetch Article Image
$doc = JFactory::getDocument();
$doc->addHeadLink('<?php echo $this->item->image; ?>', 'prefetch', 'rel', array('as' => 'image'));
?>
But the output is:
<link href="/<?php echo $this->item->image; ?>" rel="prefetch" as="image" />
How can I get the item image URL?