Building Your Menu Structure

Views: 148

The following information found in this article is simply a method that I use to build by initial Menu and Category structures on new Joomla projects. This isn't the only method nor will I ever proclaim this to be the best method. I will however state that the following information has helped me save a lot of time in finding the proper menu items quickly while also ensuring there are no issues with duplicate menu items.

How do we even know if there are issues with our existing menu structure and how to know we are building it properly for optimal SEO and organizational purposes?

Indicator #1: Breadcrumbs

When a new client asks me to help them fix their breadcrumbs, that is often the first indicator that there is most likely a bigger issue that needs addressing. This is because the breadcrumbs simply display the current structure based on menu hierarchy that was set up for that particular page. If the breadcrumbs aren't showing a proper hierarchy for an article for instance, it could very well be caused by an improper menu structure.

Indicator #2: Page URL

The current URL of the page in question could also be another indicator that is is a bigger issue at play. Since the menu structure dictates the page URLs, poor menu architecture would be easily spotted in the page URL. I have encountered many Joomla 3 to Joomla4/5 migrations that used popular SEF Extensions to "clean up" duplicate URLS, or change them altogether only to find those extensions were not updated for Joomla 4/5 and had to create lists of redirects to avoid breaking the previous links.

These are often the best times to appreciate the power of Joomla 4/5 as cleaning up the menu structure and rebuilding it using the following technique would allow you to rebuild the "behind the scenes" menu items to create the same URLS that were generated by the older Joomla 3 SEF extensions without having to reach for any additional 3rd party extension.

Understanding Joomla Menus

Many of us who have been building Joomla websites for a while have all gone through our own "trial by fire" when it comes to really learning how to best use the Joomla menu system.

Just because you don't create a menu item, doesn't mean that page won't be created

There are lots of links generated on each Joomla page and just because you didn't create a menu item for it, doesn't mean that page won't be created. The difference is if no menu item was created for a specific page, it will take then generally take the default menu id used for the homepage.

Understanding the Menu Alias type

The core Menu Item Type 'Menu Item Alias' allows you to create more than one menu link to the same item by rerouting the 'Menu Item Alias' type to the real menu item.

The 'Hidden Menu'

The most important menu in all of my projects is the one that site visitors will never see. It can be named whatever you prefer, but for this project (any many others) we will create a new menu and title it 'Hidden Menu'. This is the most important menu because almost every "real" menu link that exists in my projects sits in the 'Hidden Menu'. When I need to find a Menu Item to change a setting, I don't need to look further than the 'Hidden Menu' to find it. Gone are the days of searching through countless menus trying to find the one that controls the settings I need to adjust.

Having almost all of the actual Menu links in one place makes it easier (and quicker) to manage as well as visually ensure everything is set correctly in my menu hierarchy. Every other menu found throughout the site are all Menu Item Alias' types that point back to the main menu item that lives in the 'Hidden Menu'. I can structure my menus the way they need to be while displaying them throughout the site the way I want them to be.

The following image shows the current menu structure of this site (at the time this article was written).

Example of Joomla 5 Hidden Menu Structure

Source of Truth: Hidden Menu

All the menu links found in the 'Copyright' and 'Main Menu' are all 'Menu Alias Types' that point back to the actual menu link in the 'Hidden Menu'.

Conclusion

You will notice in menu structure of this site, that Privacy Policy and Terms & Conditions are the only menu items that sit under another menu item. This is because these two items are Single Article Menu Types (displaying a single article) and since they are sitting in the 'Legal' article category, the direct links would have 'Skipped' the parent category 'Legal' in the breadcrumbs and page URL. Since we want to ensure the menu structure remains intact, we create the Category Articles Menu Item and place the two single page article links as sub-menu items. This allows us to directly link to the specific articles without having to display a 'Legal' menu link anywhere in the front end.

If the two links in the copyright menu were not alias menu types, but instead were the actual menu items, then the breadcrumbs would be Home > Privacy Policy (skipping the Legal category thus breaking the menu hierarchy) instead of Home > Legal > Privacy Policy. The same would occur in the urls as it would show /privacy-policy instead of /legal/privacy-policy. There are always going to be cases where you want to avoid the Legal page altogether, but it's always better to know what the rules are so you can decide if and when to break them.