Putting Content Types to Work (Smart Navigation Menu's)

Many moons ago in SharePoint v2 land we often found ourselves inventing some pretty clever solutions. The problem was they took quite awhile to bring up to production level.

For example: Raise your hand if you remember the “Document Library Navigation” style used in v2, in case you’ve forgotten about this fan favorite of the time, read this blog post I made a year or so ago on the topic. Amanda introduced me to the concept about a year before I seen it used mainstream.
Let’s revisit the v2 document library navigation technique for just a moment. The main idea was you stored your web part pages in a document library, then you added some nifty meta-data which allowed you to create some fairly funky filters which displayed only certain pages in certain views. These represented the navigation. Sure it got the job done but the solution was complex, long and drawn out.

Well, that was then and this is now. Fast forward a year or so and we now have the concept of “Content Types”. I cannot stress how UNDER hyped content types are, in fact in the coming months I’d bet my bottom dollar you’ll see them at the center of alot of the next generation OOTB solutions you crazy cats build.

Lets see how we can leverage the OOTB functinality in WSS v3 to create intelligent navigation menu’s in a couple of clicks … AND make managing them much easier using our friends the content types. In the end we will have a single list to manage the links of as many menus as we wish to build.

There is a visual below every major step in case you get lost…

Creating smart navigation menu’s using content types:

Step 1.
Create a links iist to hold all of the links.

  1. Select Site Actions, Create
  2. Select Links List from the Tracking Column
  3. Name your list “Navigation Links” and click create.


Step 2.
Before you can create content types on a list or library you must first enable them. To do this:

1. Select Settings, List Settings (From the toolbar while on the Allitems.aspx view of your list)
2. Select Advanced Settings
3. Check “Yes” for Allow Management of Content Types

Step 3.
Create a content type for each navigation menu. In this example we will assume a main and sub navigation menu. The important trick here is creating your site content types at the TOP LEVEL of the site collection. That way they’re avaialbel to all sub sites below.

  1. From the Site Actions menu select Site Settings
  2. Select Go to Top Level Site Settings
  3. From Galleries Select Site Content Types
  4. Click Create, Name this one MainNav, Choose Link Content Type for Parent and Create a New Group called Custom
  5. Create another content type (by repeating the previous step) this time naming it SubNav


Step 4.
Add the content types we just created to your list. To do this:

1. Go to settings, list settings (from the list’s allitems.aspx view)
2. Locate the content types area and select add from existing site content types
3. Select the Custom Content Types Group
4. Add the main and sub nav content types and click ok


At this point we have created two potential “types” of content which we can create in our list, MainNav and SubNav. Take a look at the items in the drop down for the “New” button on your list now. Should look similar to the screenshot below.

Pretty neat huh? You can see things taking shape. When we want to create a link in our MainNav we select it when creating a new link and vice versa.

Now all we have to do is add the links list to a page and create a view. – Moving right along …

Step 5.
Create Views for Sub and Main Navigation on your list

  1. From the allitems.aspx view of your list select Settings, List Settings
  2. Scroll down to Views and select Create View
  3. Select Standard View
  4. Name it MainNav
  5. Remove all columns besides (URL) with edit menu
  6. Now the magic , Filter where Content Type  (is equal to) MainNav
  7. Click OK
  8. Repeat the process, this time naming your view SubNav and filtering where Content Type is equal to SubNav

Step 6.
Add the list the page(s) you wish to have the menu(s) on:

  1. From your home page select Site Actions, Edit Page
  2. Select Add Web Parts
  3. Add your Navigation Links List in a web part zone (add it twice)
  4. You can select exit edit mode from the top right

Step 7.
Set your web part titles and default views via Modify Shared Web Part

  1. Select the DOWN ARROW on the right of your web part title, select Modfiy Shared Web Part
  2. From the toolpane now visable on the right, select MainNav from the Selected View drop down (at the top)
  3. From Toolbar select No Toolbar
  4. Next select appearance, in the Title field give it the name Main Navigation
  5. Select OK
  6. Repeat this process for the other web part directly below, naming it Sub Navigation and setting the View to SubNav

That’s it, you are all set up. You can now add a link to your Navigation Links List and Select what navigation menu you want it to show up in. Give it a try! Pretty neat huh?


This entry was posted in SharePoint 2007. Bookmark the permalink.

One Response to Putting Content Types to Work (Smart Navigation Menu's)

  1. Nice Post!