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
|“Der… What do I do?”||“WOWEE! This site is amazing!”|
3 thoughts on “Changing the Default Expansion of MetaData Navigation on Initial Page Load”
I want to leverage the metadata navigation on my Wiki pages as well. I am working on an Enterprise wiki site in SharePoint 2010 but there are some major issues with the navigation. I can easily activate the metadata navigation in the pages library, but when I navigate to any of the pages, the navigation gets lost and I need to go back to the pages library to continue navigating. So in searching whether it is possible to use the metadata navigation on the wiki page layouts as well, the answer I found was yes, it is:
1. On the custom page layout, I can add a reference to the MetadataNavTree.ascx control.
2. Then I can add the control at the appropriate place; I used the PlaceHolderLeftNavBar.
This works great accept for one thing, once I select a Wiki page I still see the wiki nav but the filters that I just selected from those wiki categories are gone. So the end user has to start over with navigating the wiki categories to re-display the list they were just looking at OR they hit the BACK button on their browser. We all know typical human behavior is that they will expect that wiki tree nav to remember where they were at so they can just click that sub category again and redisplay the wiki pages that match that filter criteria. Basically I’m looking to mimic the same behavior of Technet :http://technet.microsoft.com/library/default.aspx
I’ve adopted MetaData navigation in SharePoint 2013. I’ve created terms in a term set that will make up the global navigation for a site. I notice that there is a limit on the width or number of characters for menu items created from the term set. Do you have insight on how to modify the default value to increase the width so my entry does not wrap to a second line? Thanks for any input.
Did anyone have issues with the solution? I got it and installed it but the metadata navigation is still collapsed. I checked the ascx file and the value is set to 2 but doesn’t seem to be applied. Any idea?