Saturday 3 November 2012

Using the SharePoint 2013 Term Store to Drive Navigation

One of the cool new features in SharePoint 2013 is the ability to use the Term Store to drive navigation.  In my previous post, I created a Term Set called Diseases.  Let’s use this to now drive the navigation for our site.
image
We can now use this term store to create multi-level navigation within our site.  Lets create a clean sub-site to start:

The sub-site creation function has been slightly buried in 2013 – its under Site Contents instead of being directly in the Site Actions menu as it was in 2010.
So let’s create a top level disease site and we’ll then create pages to correspond with our term store hierarchy. 
image
Here is my newly created Disease Site.  We can now enable the Term Store driven navigation for this site by going under Site Settings –> Navigation and selecting “Managed Navigation” for either the global navigation (the top navigation) or the current navigation (the left navigation).   Let’s do this for the global navigation for this site:
image
Choose the root node where you want to start your navigation.  There are two cool features enabled by the checkboxes below the term store:
  • Add new pages to navigation automatically: if this item is checked, SharePoint 2013 automatically creates terms in your term set every time you create a new page.
  • Create friendly URLs for new pages automatically: if this item is checked, SharePoint 2013 will use your term store to create friendly URLs based on your terms.
With these enabled, it allows you to very quickly generate a site navigation AND the associated pages based on your term set hierarchy.
Here is my site with the new navigation:
image
As you can see, the term store is hierarchical, which automatically creates hierarchical navigation for the global navigation.
Another cool feature is the page that is linked to is inherited within the term set.  So for example, let’s imagine that we want to have the same dynamic page for all the cancer terms.  Instead of creating a separate physical page for each term, we will point all terms to the same page and generate the content dynamically.  The term set navigation configuration allows us to do this by setting the linked page at the term cancer and then every sub-term underneath will automatically link to the same page unless specified within that sub-term.  So in my example, I have set the Disease term to link to a page:
image
If I drill into one of the sub-terms, it inherits the target page link unless I change it:
image
I can also specify the target link for all children of this page which is also by default inherited from the parent but can be overridden at any level of the term set.
Very cool stuff, this stuff solves a fundamental problem with navigation in SharePoint 2010 – the need to have a physical page for every navigation element.  Now I can have hundreds or even thousands of terms in my term store that simply link to a single page that dynamically serves up content based on the URL and the current term selected!

No comments:

Post a Comment