SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH
category layout
category layout

How to add top link in Magento 2?

Your website header can be a great place to put important links and pages. Some default links are already stored in Magento 2, but adding a top link to the top of the Magento 2 site will make it easier for customers to access it. Building top links also helps to encourage customers to want to buy more and more. This article show you how to add Top Link in Magento 2.

Step by step

Step 1: Create the default.xml file in the app\code\Vendor\Extension\view\frontend\layout .

Step 2: Add the following code to the newly created file

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
      <referenceBlock name="header.links">
        <block class="Magento\Framework\View\Element\Html\Link" name="top-link">
          <arguments>
              <argument name="label" xsi:type="string" translate="true">Label </argument>
              <argument name="path" xsi:type="string" translate="true">url</argument>
          </arguments>
        </block>
      </referenceBlock>
</body>
</page>

In this case, Label is the name of the title, and url is the link of the page. After changing, run the command below to save your change.

php bin/magento c:c
php bin/magento c:f