I'm trying to add a tel: href to a footer with the next code:

 <block class="Magento\Framework\View\Element\Html\Link" name="telefon">
                                <argument name="label" xsi:type="string" translate="true">0728 947 887
                                <argument name="path" xsi:type="string">tel:0728947887</argument>          

The link generates but it comes like: https://domain.com/tel:0728947887

In order for the tel: to work, I simply need it to be tel:0728947887

I also tried adding this to the block but the href did not change:

 <argument name="attributes" xsi:type="array">
                                    <item name="href" xsi:type="string">tel:0728947887</item>

I'd appreciate any ideas, thanks!

1 Answer 1


unfortunately all footer links added via layout xml generate urls prefixed with base url because of this method : Magento\Framework\View\Element\Html\Link::getHref().
But the workaround is to create a phtml template and assing it to your block. then you should be able to render the link as you wish.

Create the template called phone.phtml in one of your modules and change the layout xml to this

 <block class="Magento\Framework\View\Element\Html\Link" name="telefon" template="Vendor_Module::phone.phtml">
         <argument name="label" xsi:type="string" translate="true">0728 947 887</argument>
         <argument name="path" xsi:type="string">tel:0728947887</argument>          

The template file can look like this:

     <a href="<?= $block->escapeHtmlAttr($block->getPath()) ?>">
         <?= $block->escapeHtml($block->getLabel());?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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