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.

  • can you please share code, where and how you add link. – Pawan Aug 13 '17 at 2:33
1

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>

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.