1

I would like to add a custom top link which redirects to external URL like Google.com or a blog link etc.

I added the custom top link using referencecontainerBlock. However, I'm not sure where should I give the link for external URL which I would like to re-direct.

<referenceBlock name="header.links"> <block class="Magento\Framework\View\Element\Html\Link" name="custom-link"> <arguments> <argument name="label" xsi:type="string" translate="true">custom link</argument> </arguments> </block> </referenceBlock> 

Pls advise.

1
  • can you please share code, where and how you add link. Commented Aug 13, 2017 at 2:33

1 Answer 1

3

You can use path argumnet to give external link like this:

<block class="Magento\Framework\View\Element\Html\Link" name="custom-link"> <arguments> <argument name="label" xsi:type="string" translate="true">custom link</argument> <argument name="path" xsi:type="string" translate="true"><![CDATA[http://www.google.com]]></argument> </arguments> </block> 
1
  • so needed that, thank you ! (cuz natively it parses the path using UrlBuilder) Commented Feb 4, 2020 at 23:20

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.