0

I am working on a Magento 2.1.7 shop. To achieve this, I have created a child-theme of Magento Blank.

By default, it seems, Magento displays links to the product categories (and subcategories) in the top bar. I need to display only the CMS (static) pages there.

The code from default.xml that displays the top bar is:

<container name="navbar-collapse" htmlTag="div" htmlClass="collapse navbar-collapse" htmlId="wg-navbar-collapse">
  <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="html/topmenu.phtml" ttl="3600" before="-">
     <arguments>
       <argument name="parent_item_class" xsi:type="string">dropdown</argument>
       <argument name="submenu_class" xsi:type="string">dropdown-menu</argument>
     </arguments>
  </block>
</container>

Replacing catalog.topnav with cms.topnav did not produce any change in the frontend. I could not find a way to do that through the admin either.

How must I do it?

Alternatively, is there a free plugin for this functionality?

Thank you!

Razvan Zamfir
  • 571
  • 1
  • 21
  • 43

1 Answers1

0

You have to create a plugin in your custom module to achieve this. Have a look at this answer to add your cms-page/custom-link in top menu.

Adding a non-category link to the navigation links in magento 2

Dinesh Yadav
  • 6,447
  • 2
  • 23
  • 50