How to add menus and links to your Drupal 6 website

Once you’ve created a page for your site you are probably going to want to add a link to that page at some point. If you had a Drupal developer like myself build your site then you probably already have a couple of menus in place already, but what happens if you want to add a new one?

Well, you can call me and have me do it, but in my opinion that would an expensive option especially since Drupal 6 makes it extremely easy to do yourself.

Before we go into actually adding menu I am going to explain a few concepts that you should understand before starting. There are four essential parts involved when administering menus in Drupal:

  1. Links: which can be edited, moved to other menus or deleted.
  2. Menus: which holds a set of links, but which can be empty if you remove its contents.
  3. Blocks: which holds the menu, and which must be enabled in order to view the menu or to position it on the page somewhere. Blocks can hold other content besides menus.
  4. Regions: are the areas on the page where a block containing any content including a menu can be enabled. The number of regions and their size, position, and styling will vary depending on the theme you are using.

Alrighty, now that we got the vocabulary out of the way lets go through the steps needed to add a new menu, add links to it, and enable its block on a page.

First go to the menus page under “Site Building” > “Menus” and click the “Add menu” tab at the top of the page. For the “Menu name” field you have to use a machine readable word. Now machine readable may not be a common term in English, but in Drupalese it is very important. What machine readable means is that you can only use lowercase letters, numbers, and hyphens and it can’t be a repeat of another menu name you already used. The title is the version that you the user will be seeing. The description is optional. Click save when you’re done and you will be taken to the administration page to that menu.

You don’t have any links in your menu yet, so let’s add one by clicking “Add item”.

Hint: USE FIREFOX when editing your Drupal site. Firefox lets you open up multiple tabs so you can view more than one area of your site at a time. This is very useful when adding a menu item since it allows you to have the page you are linking to open at the same time as the menu administration page. PS. You should be using Firefox anyway.

Now here’s the part that trips newbies up at first. There is a field called path and a title field, but where are you supposed to go to get the path? The answer is this: you get the path from the page you want to link to. Now once you have been doing this a while you will probably get into the habit of copying the paths from your new pages as soon as you create them but in all likelihood if you are reading this you probably didn’t do that. You will need to the path before you can go any further. To do so you may need to view my tutorial on the Drupal Content page to help you find the node. Whether you use that tutorial or not you need to get to the node you that are wanting to link to somehow.

Once you have the page open that you want to link to go to the very top of the browser page where is shows the URL. For example /contact-aaron. The part of the URL that we need is that which begins after the .com/ in this case “contact-aaron”. Copy everything to the right of the “.com/” or the “.net/” or the “.org/” and go back to your menu page.

Note: The naming of these fields is a little misleading to those who have experience with html since what they are calling the description is actually the title attribute in the actual html.

Now that you have your path paste it in. For the link title type in the text that you want to be visible for the link. The description isn’t really required but it may help boost your ranking slightly if you make use of key words here. Click save and you’ve got a new link.

Note: Drupal 6 doesn’t allow you to put in links to pages that don’t exist. This can be really handy in that it prevents you from having broken links on your site, but on the other hand you can’t add filler links unless you use an absolute URL referring to a 3rd party site.

Alright, now you have a menu and a menu link, but where is it? Why isn’t it showing up somewhere on your page? That’s because we haven’t put it anywhere yet. We need to position its block on the page.
Go to Site Building > Blocks and scroll down till you find the title of the menu you just created. (Remember you are looking for the menu not the menu link).

Once you have found it you will notice that in the Region column there is a drop down menu and the current state for your new menu will be . To change that choose an option from that dropdown such as Left sidebar, Right sidebar, or whatever is available. Your block will seem to disappear. This is due to ajax. It isn’t really gone, it has just been relocated to the region section you chose. If you scroll up you can see where it has been added.

You must save the blocks page before anything will be changed. Once you do your block should appear where you placed it. Now when you want to add new menu items it will be much simpler since you will only have to add the link and it will instantly appear in the block.

A couple of pitfalls to be aware of: Page permissions and link permissions are directly linked in Drupal 6. If you create a link to a page that is not published it will not be visible on your menu. The same goes for pages that have restricted access due to restrictions put in place by the administration or other modules.