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="-">
       <argument name="parent_item_class" xsi:type="string">dropdown</argument>
       <argument name="submenu_class" xsi:type="string">dropdown-menu</argument>

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!

  • This will require you to create a custom module or buy an extension, since this functionality is not part of Magento core – gabehou Oct 25 '17 at 16:00
  • Where can I copy one from? Magento is really new to me. – Razvan Zamfir Oct 25 '17 at 16:10
  • You will need to develop one from scratch or buy an extension, It's a long process creating this functionality – gabehou Oct 25 '17 at 16:13

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

| improve this answer | |
  • Is there a free plugin for this functionality? – Razvan Zamfir Oct 26 '17 at 8:55
  • It's a custom plugin. You can create your own plugin using above link. If you are creating your own custom plugin then it is absolutely free :) – Dinesh Yadav Oct 26 '17 at 9:09

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.