Menu Mastery

A menu is a logical collection of links for navigating a web site. A Drupal menu is created gradually as you add content.

Adding and Removing Content from the Menu

To create a link to a new page in the menu, click "Add content" in the gray shortcut bar at the top of the page. The title field is required. Scroll to the bottom of the edit form and check “Provide a menu link” under the menu settings tab at the bottom of the edit form. This will expose additional fields related to menu settings. As a best practice, a site should never have more than seven links in any single menu level.

The ‘Menu link title’ field in the menu settings is the text that will display in the menu. By default, Drupal will use the title displayed on the full page, but you can use a shorter version in the menu.

The ‘Parent item’ selection box shows what the parent link for this item will be.  If this page will be a top-level menu link, the Parent item should be '<Your Site Name>'.  If this will be under an existing main menu link, select that link as the parent.  For example, to put an ‘About’ link in the top menu of the FAQs site, its parent would be ‘<FAQs>’. To put a ‘History’ link under ‘About’ to display in the left menu of that page, you would select ‘About’ as the parent.

The ‘Weight’ field defaults to 0 and determines the order in which the links will appear in the menu.  The links will appear numerically with the smallest numbers at the top.  If all links have the same weight, the links are ordered alphabetically. The content edit page isn’t the easiest place for reordering links, so you can usually ignore weight here.

menu-contextual.pngReordering the Menu

While you should always add content to the menu through the content’s edit form, the menu administration page is the easiest way to rearrange menu items.

When hovering over a menu, you should see a gear icon if you have permission to edit that menu. After clicking the gear, you’ll get two options – “reorder menu items” and “edit menu”. Click “reorder menu items.” You may also reach the menu administration by clicking on one of the menu links in the shortcut bar.

Once on the menu administration screen, click and drag the crosshair icons to rearrange menu items. (See picture below.)

Linking to Files in the Menu

Drupal validates that an internal path exists before allowing a user to add it as a menu item. Since files are not content from Drupal’s perspective, the only way to add a direct link to a PDF in the menu has been to copy the absolute URL path to the file. Disadvantages to this method include moving between development and production, knowing where the file is attached, and keeping the file name consistent as the file gets replaced.

To address these problems, in Drupal 7, there is a content type called “managed file.”

To add a file to the menu, create a managed file. If you will only be using the file in the menu, you only need a title and the file to upload. Use the menu settings at the bottom of the managed file edit form to add the file to the menu.

Linking to External Content in the Menu

The only time a content manager should use the “add link” button on the menu administration page is to add a link to page outside of the Drupal site (e.g. a link to the academic calendar). To get to the menu administration page, either click the gear icon that appears when hovering over a menu and choose “list links” or click on the appropriate menu in the shortcut bar. Then click “add link” at the top of the page. Menu link title is how the text will appear in the menu, and path is the URL to the external page. Make sure to click “Save” when you are done.