Menus are how users move around a website; by clicking on words like 'Services' or 'Contact Us', they will get to your content. As such, it is important to think about what the best terms are to describe your site to someone who isn't familiar with what you or your organization offers. Happily, the time it takes to think through and decide on the best options probably takes less time than it takes to actually build them.
Drupal 7
Drupal 7 comes out-of-the-box with four menus. The 'Main menu' is used for the major sections of the site. It is the primary navigational menu. This is the menu to which content items are added from the Menu Options in content editing. The 'Management' menu contains the links for the administrative tasks (Content, Structure, etc.). The 'Navigation' menu provides a menu of quick links that is exposed to site visitors. The 'User menu' provides the logout link and links for an individual user to manage his/her account.
The next few steps show you how to add a new menu as well as how to add new items (links) to an existing menu. The steps are essentially the same for Drupal 6 and Drupal 7 with minor differences in labels.
Creating a new menu
Start by going to the navigation menu and follow the links: Administer > Site building > Menu
You'll end up at the Menus page
There are three fields: menu name, title, and description
- Menu name
- The menu name has to be 'machine readable', which means that it can't have spaces, punctuation, and has to be lower case (like the help text says). This is for Drupal's own internal use.
- Title
- The title is for humans and may be visible to site visitors as well. It can be anything you want.
- Description
- Writing a description for your menu can be useful to describe why the menu was created.
Once you have entered your information save the menu.
Adding a menu item to an existing menu
Click on the name of the menu you would like to edit. (If you created an entirely new menu per the above, the navigation menu will now show that new menu, e.g. 'Foo Bar'.)
To add a new menu item, click the Add item link
- Path
- The path is where the menu entry will take your visitor. This can be external, as it is in this case http://drupal.org, or internal such as node/1 or admin/reports.
- If you have clean url's enabled you may also enter the path alias (see note below on adding content to menus during content creation).
- Menu link title
- Give your menu entry a title. In this example, Drupal
- Description
- A description can be useful to tell yourself and others what the menu entry is for
- Enabled
- This checkbox allows you to make the menu entry active or inactive (show or not show) without having to delete it.
- Expanded
- If this menu entry has sub-entries, known as children, this allow the menu entry to stay expanded so that the children are shown by default.
- Parent item
- Parent item selection allows you to choose where in the menu hierarchy your menu entry belongs.
- Weight
- Weight defines the relative rank of your menu entry. A smaller number means it is placed higher up.
Now save your menu entry.
Display your new menu
To display a new menu you will need add a Block display to your Drupal installation. To do so, go to Administer > Site building > Blocks and scroll down to the 'Disabled' section (where blocks that aren't currently being displayed are managed). You can activate the Foo Bar block by dragging it to the left sidebar (or any other region). When complete, you should see:
Your left sidebar should now display Foo Bar followed by the link you specified
You should now be able to create and edit menus. You can read more about blocks at Blocks - Adding extra information
Once the menu has been created it then becomes available to the content creation form (node/add). When creating a new node the node may be directly added to any of the available menus.
Watch the video showing this tutorial at Vimeo/Youtube.
Drupal 6
Drupal 6 comes out-of-the-box with three menus. The first is the 'Navigation' menu, which is the one used to administer the site (it has the 'My Account' and 'Administer' links in it). There are also the 'Primary' and 'Secondary' menus, which show up in different places on the page (and, by default, are empty in a new Drupal installation). You can also add new menus, like 'Footer Links' or 'Foo Bar' or anything else you might like.
Comments
Point to a file
In the "Path" is there a way to point a menu item to a file in sites/default/files? I would like to put a pdf document in there as part of the menu.
Never tried it
I have never tried it and don't anticipate doing so, but off the top of my head, I can't see why it wouldn't work. Back up your database and give it a try.
NancyDru
Pointing to file located in "files"
I tried and tried, but to no avail.
Complete URL
I tried it and it worked; however I had to give the complete URL of the file, not just a relative file name.
My site is at http://localhost/DrupalTest which is
/data/DrupalTest/GSite on my hard disk;
using the URL http://localhost/DrupalTest/extra/Address.pdf
I can reach the file /data/DrupalTest/GSite/extra/Address.pdf
Isn't there an easier option?
I don't understand the menu system. When I create content, there is a "Menu Settings" section. What is that for?
The complicated part is, I have to take note of my pages's URLs for creating the menu. This generates a lot of errors. I think there has to be an option to create a new page and add to a menu without having to write down the new page node and creating a new entry in a menu with this information.
But I cannot find this information anywhere...
It works
Ok, answering my own question, after I created the Menu as described in this document, now I can create content and add to this menu from the "Menu Settings" in the Add Content area.
So, the steps are:
1.-Create a new Menu and assign to a Block
2.-Add content to the menu directly from the "Menu Settings" option in "Add Content" area.
Am i right?
Putting menu on listed page only
Hi,
I created a new menu and added items to it. Then i went to blocks and configured the menu such that it appears only on a particluar page. I have created that page and gave the node path for that page in the space given. However the menu refuses to show on that particular page. If I select the option of show menu on all pages then it shows. Could anyone tell me why this is happening?
Thanks,
Niketa
Problem is with path format.
The problem lies with the path format in the information box.
You'll find the good syntax (and the bad ones) at:
http://drupal.org/node/895498#comment-3380950
God bless.
Node/Path selector instead of path input
Hi all,
It is not easy to create a new menu entry with input path value manually. I suggest that Drupal CMS replace path textfield with a node/path selector.
Thanks and regards,
Son Nguyen.
Feel free to
Open a feature request at http://drupal.org/project/issues/drupal. It will have to be for Drupal 8.
BTW, think about how long that selector would be on a site as big as this one.
NancyDru
Facing problem in Listing secondary menus
I am a newb and this may seem quite a dumb question to many of you but in spite of putting lot of efforts i haven't been able to list secondary menus under the primary menus.
I have created a new primary link and then added menu items to it.I did things which i thought should have been done for that...
like through menu settings adding source for primary and secondary links ... then enabling "Expanded" option for menu items
Haven't been able to list secondary menus on my site... i have also tried different themes still
secondary link was shown only on applying those themes which had superfish plug-in ... its my guess ..as i am still learning
Not that way
If you have a theme with Suckerfish menus, you put the child items directly under the parents (same menu) and mark the parent as expanded. For some themes, you move the parents to Primary Links and for some themes, it works off Navigation.
NancyDru
problem remains!
thanks for responding but let me tell you one thing that i am using garland as my administrator theme ... and i dont want that suckerfish thing ... i just want to list secondary menus according to each primary menu item... what you have told about the expansion thing works for me but i dont need it..
i have created one menu only ... is this the problem
IIRC
If I remember correctly, Garland will put Primary menu items in the header section with child items in a smaller size ABOVE the primaries. I don't think Garland does anything with the Secondary menu (Navigation and Primary only).
NancyDru
i guess ur mistaken
check this video --> http://www.lullabot.com/node/444/play
garland works for secondary menus
Okay
I don't use Garland much, nor secondary menus, so obviously this has been addressed since the last time.
NancyDru
Need help
After trying for a week now i am giving up on this problem... nobody has been able to tell me "what might be the problem"?
thanks for your support
Contact
Feel free to use my contact form.
I suspect your "problem" is that you are trying to make this more complex than it needs to be. This is quite common.
NancyDru
Question
Ok I have searched and searched and I have no clue what I'm doing wrong.
basically according to the video I should be able to click on the Menu item and it will expand. However it is simply taking me to a page.
I'm sure its so simple but all I want is that my menu items with their dropdowns should NOT be active links and simply just show the sublinks.
Eg. I have, ABOUT, with sublinks, About Us, Our Team, Associates.
I do not want a page to open when I click on the about menu item.
How do I go about this?
Dropdown menus
As far as I know all menu items have a URL associated with them (there may be a way to avoid this for expandable menu items that I don't know). If you are using a menu with dropdowns (generated via css or javascript) then usually you just hover the mouse over the parent menu item and the dropdown will expand. Some modules that create these menus have a configurable time delay so you might have to leave the cursor over the menu item for a second or so (but don't click on the item).
Most themes (out of the box without additional modules) do not have auto-dropdown menus and you have to click on an item and download a new page which will have the menu item expanded - make sure you actually do have dynamic dropdowns before wasting too much time banging your head against a wall.
Correct
This has been the subject of ongoing debates for quite a long time. Currently all menu items are required to have a URL, therefore, clicking an item will open a page. Many of us in the Drupal community would like to see that changed. In the meantime, you might check out http://drupal.org/project/empty_page.
NancyDru
Thanks for the confirmation
I am willing to live with the fact that I need a landing page for my menu items even if it just contains a couple of lines of text and a list of child pages from the next level of the menu. In some cases I have found this necessary as I have not been able to access all the menu items from the dynamic drop-down. When using Nice Menus in a sidebar on a short page the desired menu items are sometimes off the end of the page and are inaccessible so I have to click on the parent item to get a list which I can see and scroll through.
Anyway, a possible way to disable the page change on a parent menu item would be to attach a simple onclick JavaScript event to link with return false. This should stop the link from activating if someone clicks on it. The only problem is to have the script which attaches the events identify all the items you want to disable. This would need a bit of careful upfront planning and application of class / id in css and of page content so nothing vital is missed by not being able to access pages.
By the way, great series of articles. I have been using Drupal on/off for over 3 years now (since before the outbreak of articles aimed at beginners). It is good to read these to either point me in the direction of things I have missed or confirm that I have been using the right approach after all.
Thanks
I am going to try that module out shortly to see if it can solve my problem on one site.
Thanks for the feedback on this book. After running through it at a Drupal Camp recently, I am thinking of a major overhaul on it.
NancyDru
re: parent menu item without a
I see the request often that people do not want to create an index type page for their parent menu item; they want to jump directly to the content.
Parent item (About Us)
---Child (our chapter)
---Child (our organization)
---Child (our web site)
Basically, you can set the Parent Item and the first Child item to the same path. Once on any of the Child pages, all the menu Child items would be available to the User.
adding menu tabs
Hi,
This might be a silly question but I am new to drupal and I am stuck as to how do I add a menu tab. I am able to add the menu items but I do not know how to add them as tabs above. Eg. about us blog, login..
thanks,
Prerna
Mostly Theme
This is usually done by the theme, unless you want to do some PHP coding. You need to locate a theme that supports tabs.
If you are using something like Garland from core, then you can get something sort of like tabs by moving a menu item into Primary Links. But it doesn't look anywhere near as good as real tabs. (See http://nanwich.com for an example.)
NancyDru
Displaying menu item on one page only.
Hi,
Have you been able to figure out how to display a menu item within a block on one page only?
Just like niketahira (October 6, 2009 comment) I can't get the block to display on one page only after giving the path of that page. It just doesn't show. Depending upon the display selection, it either displays on every page or on none at all. Is that a theme problem (I am using Garland while I develop the website) or a misconfiguration of some sort?
Thanks.
Problem solved!
I am replying to my own comment as I was able to resolve the issue after I posted it thanks to someone's help on the Forum. The problem lies with the path format in the information box.
You'll find the good syntax (and the bad ones) at:
http://drupal.org/node/895498#comment-3380950
God bless.
Another comment/suggestion I
Another comment/suggestion I would like to make:
I agree with those who complain about the documentation and the difficulty of working with Drupal. I have done a lot of programming in the past (high level and low level languages - assembly, etc.) and I am totally lost in Drupal!
The Cookbook, however, helps a lot. It kind of ties things together and that's very good. Thanks to you.
What I would suggest is that you take the readers on a step-by-step project from begining to end. Nothing complicated but comprehensive enough to go through the most important and relevant features of a website. It can be in several parts and studied over several days.
Just a suggestion.
God bless.
In my spare time
I will probably do that. Here's a start http://techtv.mit.edu/videos/7860-drupal-cookbook-for-new-drupallers
NancyDru
That's good! All I have seen
That's good!
All I have seen thus far are technies or "technocrats" who, although very helpful, obviously enjoy the tweaking of modules and such but with little interest in complete website development and newbies who want to create websites but who have no understanding of the technicalities involved.
Someone has to bridge the gap soon otherwise Dupral will be relegated to the domain of pure intellectual gymnastics and lose all appeal for practical development. This kind of thing has already happened in the past.
Keep up the good work!
Oliver.
adding pages to primary menu
i created primary menus but when i click on them, the pages are not found.
how can i add pages to primary menus?
thanks
Hmm...
Can you get to those pages without the menu?
NancyDru
Does this work in Drupal 6?
Can the Drupal menu be added to the Foo Bar block, in Drupal 6, as in the above tutorial?
I've tried creating a Forum block and couldn't work out how to move the existing Forum menu from the navigation menu to my new Forum block.
Edit: I've figured it out now.