1

Hello Can you help me on how to add custom top links in the header area of Magento 2,

Like this: Header Links

0

You can manage this using Static Block. In your theme default.xml you can add new static block.
File Path : Custom\tutorial\Magento_Theme\layout\default.xml

<referenceBlock name="header.panel">
<block class="Magento\Cms\Block\Block" name="header_promo_top">
    <arguments>
        <argument name="block_id" xsi:type="string">header_promo_top</argument>
    </arguments>
</block>
</referenceBlock>

Here header_promo_top is your static block that will contain your content.

Magento 2 default theme usesheader.panel Container for showing languages switcher and skip content block in Top bar. You can get more idea about this using the below file:
vendor\magento\module-theme\view\frontend\layout\default.xml

  • Hello Pankaj, Thank you for this answer of yours. I will try this one. I have another question. Is it possible to create toplinks using modules? – MazeStricks May 31 '16 at 6:00
  • yes it is possible – Pankaj Pareek May 31 '16 at 6:07
  • Hello Pankaj, Thank you so much you solved my problem. :) – MazeStricks May 31 '16 at 6:10
  • Can you teach me on how to create blocks using module? and what's the the difference when you use static blocks and module? – MazeStricks May 31 '16 at 6:11
  • I would suggest you to try at your own using online blocks and tutorials and if you face any issue you can post your questions on SO. some one or may be I will definitely help you – Pankaj Pareek May 31 '16 at 6:16

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.