Вопрос

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.

Это было полезно?

Решение

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>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с magento.stackexchange
scroll top