Applies To: SharePoint 2010
We’ve recently begun making fairly heavy use of the MetaData Navigation available for lists. It’s intuitive and easy to use and our users are really liking it. But one minor, but frequently mentioned, irritation brought up by nearly everyone who tried to use the site was that the navigation elements were collapsed by default when they went to the site.
This isn’t a big deal for most people since they get used to where the navigation elements are (just expand the folder), but does create an extra barrier for new users as they try and figure out how to use the site. Microsoft has taken an awesome feature and traded it’s potentially intuitive use to account for some potential performance issues.
The issue seems to be that navigation using taxonomies with several top level items would significantly delay initial page load. This is certainly true, but the solution is not to cripple all uses of MetaData Navigation, the solution is to not use it with those types of taxonomies! Not only would you have had that performance issue on initial expansion anyway, having that many top level items makes for bad navigation. If your taxonomy has several top level items (2000+) then it is either not a good candidate for MetaData navigation or you need to group those items into sub-nodes.
In searching for an answer to this problem I came across this answer on technet by Entan Ming. In it he gives the manual steps to take care of this issue. Here is a brief summary of the steps that must be performed manually on every server:
- Open the MetadataNavTree.ascx file in your 14 Hive (TEMPLATE\CONTROLTEMPLATES) using notepad
- Change the line ExpandDepth=”0″ to ExpandDepth=”2″
- Save the changes and refresh the page(s) with MetaData Navigation
These are easy to do and you can follow them and be done. However, just like PDF Icon Mapping there are some problems with this approach:
- Manual changes can often be error-prone
- The change must be performed on every server
- The change must be performed whenever a new server is added to the farm
- The change will have to be redone in the event of disaster recovery
So, using the same technique I use for PDF Icon Mapping entries, I’ve created a SharePoint solution to do this automatically.
You can find this solution over on CodePlex as WireBear MetaDataNavExpansion. It is free for personal and commercial use (License here). You can also find basic installation instructions as well. It’s super easy to setup since it’s just a standard SharePoint Solution that you globally deploy.
The full source code is available on CodePlex and I’ll write up another article about what’s really happening, but here’s a general summary:
- On Activation and Deactivation a one time Service Timer Job is run.
- On Activation, the Timer Job creates a backup of the MetaDataNavTree.ascx file within the 14\TEMPLATE\CONTROLTEMPLATES folder.
- The MetaDataNavTree has it’s tree’s ExpandDepth property changed from 0 to 2
- When Deactivating, the Timer Job restores the original MetaDataNavTree.ascx file
It’s pretty straightforward. It just automates the manual steps listed above. This allows it to be applied automatically to any new servers added to the farm and will be reapplied in the event of disaster recovery.
Here’s what it looks like on initial page load
Standard: |
With MetaDataNavExpansion: |
 |
 |
“Der… What do I do?” |
“WOWEE! This site is amazing!” |
Like this:
Like Loading...