I want to insert an svg file as favicon in Joomla. I have found the function addFavicon in Joomla core files (/libraries/joomla/document/html/html.php) which inserts the favicon link but I don't know how to use it and where in my template.

Thank you in advance for your answers.


I haven't tried using an SVG as a favicon, but the addFavicon function is part of the JDocumentHTML class, therefore you should use it like so:

$path = JUri::root() . 'templates/MY_TEMPLATE/file.svg';
$type = 'image/svg+xml';
$rel  = 'icon';

$doc = JFactory::getDocument();
$doc->addFavicon($path, $type, $rel);
| improve this answer | |
  • Inserting the addFavicon function in the UpdateHead() function of my template did the trick. The page source now shows the html code for changing the favicon. – dfk_7677 Sep 14 '15 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.