Back to Top

Header and Top links in Magento 2

Updated 28 February 2024

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,

Searching for an experienced
Magento 2 Company ?
Find out More

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.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


  • yassel
    • abhishek (Moderator)
  • Rita
    • Sanjay Chouhan (Moderator)
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home