Add Static Links to Top Navigation Menu in Magento

Add Static Links to Top Navigation Menu in Magento

July 14, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Add Static Links to Top Navigation Menu in Magento

Magento provides robust customization options for your store’s navigation menu. While most links are dynamically generated from product categories or other data sources, it’s common to want to add static links as well—hyperlinks that don’t correspond directly to a category or product.

Understanding the Current Setup

Let’s first understand what you currently have in place:

<?php echo $this->getChildHtml('topMenu') ?>

This line of code is using Magento’s block hierarchy to fetch and display the ‘topMenu’ block. By default, this block contains the dropdown menu generated from your product categories.

To add a static link, you’ll need to modify the app/design/frontend/<your-theme>/template/page/html/topmenu.phtml file. Open this file in a text editor or IDE.

In this template file, find the following block of code:

<?php if (count($block->getNavigationLinks())):
    foreach ($block->getNavigationLinks() as $_link):
        // ... (rest of the loop)
    endforeach;
endif; ?>

This is where Magento populates your navigation links. You can insert a static link by adding another li element within this loop, before or after the existing elements.

For example, let’s add a link to Google:

<?php if (count($block->getNavigationLinks())):
    foreach ($block->getNavigationLinks() as $_link):
        // ... (rest of the loop)
    endforeach;

    echo '<li><a href="https://www.google.com" target="_blank">Visit Google</a></li>';
endif; ?>

This will add a new list item with an anchor tag linking to https://www.google.com. The target="_blank" attribute opens the link in a new tab.

Best Practices and Considerations

Remember, any changes you make to this file are theme-specific. If you switch themes or update your current theme, these changes will be overwritten.

If you want to ensure your static links persist across themes or updates, consider using an extension like Amasty’s Navigation Menu module from Laravel Company.

Conclusion

Adding a static link to your Magento top navigation menu involves modifying the topmenu.phtml template file. This is a straightforward process that doesn’t require extensive coding knowledge.

However, if you plan on adding multiple links or complex navigation structures, consider using an extension for better stability and future-proofing. This will keep your code organized and ensure your website remains functional even as Magento updates occur.

Remember, always backup your files before making changes to avoid any potential loss of data.

Catalog API Themes

Our network