0

I want to add a few links in a Magento 2 store's head element, to serve a favicon bundle (OS specific link icons etc). In my theme directory I've added a new default_head_blocks.xml:

./app/design/frontend/MyTheme/std/Magento_Theme/default_head_blocks.xml

With following content:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <link rel="apple-touch-icon" sizes="180x180" href="favicon/apple-touch-icon.png">
    <link rel="icon" type="image/png" sizes="32x32" href="favicon/favicon-32x32.png">
    <meta name="theme-color" content="#ffffff">
</head>

Problem is, these tags never show up in the html. I've added a default.xml in the same folder to remove the standard Report Bugs link and that link vanished faster than my salary on a Friday. I can also browse the image URLs manually to get the icon images. But still, the links never show up.

What am I missing here?

PS. Must point out that the theme inherits Blank.

Sven
  • 892
  • 14
  • 29

1 Answers1

0

Problem solved. The link elements shall have a src attribute instead of a href. And if one element fails, all fail. This code works:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
     <link rel="apple-touch-icon" sizes="180x180" src="favicon/apple-touch-icon.png">
     <link rel="icon" type="image/png" sizes="32x32" src="favicon/favicon-32x32.png">
     <meta name="theme-color" content="#ffffff">
</head>
Sven
  • 892
  • 14
  • 29