Magento2 – How to Add Static Block to Header Menu

createheadermagento2static-block

My Categories are displayed in my Header Main menu. Now I want to add another link( called 'about us') after the last category in my header.
I plan to create a static cms block -> in it's content put some html:

<ul>
    <li class="ui-menu-item level0">
        <a href="#" class="level-top"><span>About Us</span></a>
    </li>
</ul> 

then add this static block to the header. How can I achieve this ?

Best Answer

Firstly you need to create static cms block about us. and add your content in content part.

Now to add that block in header follow the below steps :

  1. Create/Add new category from product/categories from admin menu.
  2. Make Sure Enable Categories menu and Include in menu is selected as enable.
  3. Click on Content tab and go to the Add CMS Block - Select your about us cms block from there.
  4. From Display settings , Select Display mode as a Statick Block only and Anchor as yes.
  5. Click on Save button and after that run the cache:clean command and check.

Screenshot for select static block : enter image description here

Screenshot of display settings :

enter image description here

Note : You can also do it same thing by overriding the respected template.

Related Topic