1

I need to add custom nav link directing to an external site (http://etc) in my top nav. Admin won't let me do this. Running locally on mac web server.

V 2.0.13 Luma child theme

Thanks

0

Do following steps:

go to root directory\app\design\frontend\namespace\theme\Magento_Theme\layout

and open default.xml file

Add below code in default.xml file before body tag end to add link in top links

<referenceBlock name="top.links">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="top-links-custom-link"  before="-">
            <arguments>
                <argument name="label" xsi:type="string">Menu name</argument>
                <argument name="path" xsi:type="string">url</argument>
            </arguments>
        </block>
    </referenceBlock>

Add below code in default.xml file before body tag end to add link in top menu

<referenceBlock name="catalog.topnav">
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="catalog-menu-custom-link"  before="-">
                <arguments>
                    <argument name="label" xsi:type="string">Menu name</argument>
                    <argument name="path" xsi:type="string">url</argument>
                </arguments>
            </block>
    </referenceBlock>

like this:

https://www.screencast.com/t/h3qLV5FUw

hope it will help !!

  • I gave that a shot but it's still not showing. Flushed my cache. Do I need to do something in my admin too? – guest Apr 8 '17 at 6:50
  • Please send me your default.xml file code @guest – Mukesh Prajapati Apr 10 '17 at 5:29

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.