Request Quote

Header and Top links in Magento 2

In this blog I will explain how to add header and top link with default.xml file. Header link is displayed for both guest and logged in customers. Top link is displayed only for logged in users.

To show the links create default.xml under Webkul/Menu/view/frontend/layout folder

<?xml version="1.0"?>
<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="header.links">
            <block class="Magento\Framework\View\Element\Html\Link" name="header-menu">
                    <argument name="label" xsi:type="string" translate="true">Header Menu</argument>
                    <argument name="path" xsi:type="string">*/*/*</argument>
        <referenceBlock name="top.links">
            <block class="Magento\Framework\View\Element\Html\Link" name="top-link">
                    <argument name="label" xsi:type="string" translate="true">Top Link</argument>
                    <argument name="path" xsi:type="string">*/*/*</argument>


For guest customer, 


For Logged in customer,


Check out the following blogs regarding links,

Add Custom Block and Link Header in Magento 2

How to add custom link in navigation menu in Magento2

Magento2 – Add New Link in My Account Navigation Panel

call custom block and links in footer in magento 2


Feel free to comment if any issue occurs.

. . .


Add Your Comment

Be the first to comment.

Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again