Skip to content Skip to navigation

Site Retired

As of May, 2022, this website is no longer updated and has been replaced with a static copy.

Menu Tricks #1: Improve Site Navigation with Menu Blocks Module

The main menu in Drupal is a very powerful tool when partnered with the right modules and configurations.  The menu can be used to automate URLs, build breadcrumbs and create secondary navigation.  

In this post, I'll be walking through a module that can help you use the main menu to automate all of your menus and simplify your secondary navigation.


When you're building in Drupal, I highly recommend putting all of your pages into one giant main menu.  Think of your main menu as the sitemap for your website. 

This will help you clarify the structure of your site, which is always a great practice.  But it also opens the door to very nifty automated configurations.

You may be thinking to yourself, but this will cause me lots of duplicated work for items below the top or secondary item level because I'll have to add nodes to the main menu and to the one-off menus that I place in those sections of the site. That's where menu block comes to the rescue.


With Menu Block, it's possible to create a block that displays menu trees starting with any level and going to any depth. Here's an example: 

I have a site with a horizontal main menu in the header that only displays top level items.

I want to add a sidebar menu that will display secondary and tertiary main menu items underneath each top level item. Here's how to do that with the Menu Block module installed:

Making a Menu Block

  1. Go to Structure > Blocks > Add Menu Block
  2. Optionally add a block title.  If you leave this blank the block title will be the parent item of the branch of the menu you are looking at.
  3. Create an Administrative title for the block.  You probably want to include the name of the menu, the starting level and depth in the title.
  4. Choose the menu you are making the block from.  In this case, main menu.
  5. Choose the starting level, this is the depth of the links that will appear.  To show the top level items, you would choose 1st level.  In this example I'm using 2nd level.
  6. Choose the maximum depth.  This will determine the number of levels that will appear.
  7. Save



Placing the Menu Block

Using the core block system or a module like Context, place the new Menu Block on all pages where you would like to have an automated main menu.  

For a simple site, I often will place this block on all pages but <front>.

Testing Your Menu Block

If you haven't yet, add some secondary (and tertiary) pages to your main menu tree.

I added a test page that is a child of Home and another that is a child of Top Level Page.  I've included a screenshot of my menu tree, as well as the new menu I see in the sidebar of "Top Level Page" and "Secondary Page".

Simple and pretty nifty!






Menu Block is one of the modules that is on the short list to be added to the Sites service here at Stanford!  Stay tuned.