I am using Magento 2.2.2 and I am trying to add some custom menu links to magento in the mobile menu layout.
I tried adding a custom block with menu links by referring catalog.topnav block
default.xml
<referenceBlock name="catalog.topnav">
<block class="Magento\Theme\Block\Html\Topmenu" name="custom.catalog.topnav" template="Mymodule_TopMenu::html/topmenu.phtml"/>
</referenceBlock>
topmenu.phtml
<li class="custom-menu">
<a href="<?php echo $block->getUrl('about-us'); ?>">About Us</a>
</li>
After doing so, the menu links are getting added to the navigation menu bar. And i am using a custom css to hide those menus from desktop layout. Only in mobile layout i am displaying it.
The problem is the menu links needs to be present in the navigation menu bar so as to display in the mobile layout as well. But i wanted to render my custom menu links only in mobile menu layout.
How can i achieve it ? Please suggest some approach.