Sunday, April 7, 2013

Managed metadata navigation and friendly URLs in Sharepoint 2013 – part 2

In the first part of the article I described basic functionality of managed metadata navigation, introduced in Sharepoint 2013. In this second part I will continue overview of new feature and will show how friendly URLs are working in conjunction with managed metadata navigation (Update 2013-04-21: third part is here).

Let’s examine URLs of the navigation terms which we created in the 1st part:

Navigation term URL
Company /company
Company > About us /company/about-us
Company > Contacts /company/contacts
Company > Investors /company/investors
News /news
News > News archive /news/news-archive
News > Press releases /news/press-releases

As you can see URLs are similar to navigation term titles and they don’t contain any /Pages/default.aspx part. These are friendly and clean URLs, which are created automatically from term title. Note that spaces in the titles are replaced by dashes.

Let’s check properties of the navigation terms in Site settings > Term store management and find local site collection’s managed metadata group (remember that this group is visible only when term store is opened in context of its parent site collection. I.e. it won’t be shown if we open e.g. Managed metadata service application from Central administration). For each term there are several tabs with properties available:

image

These tabs are:

  • General
  • Custom sort
  • Navigation
  • Term-driven pages
  • Custom properties

General tab is similar to those which was in Sharepoint 2010. The great addition in Sharepoint 2013 is that now it is not necessary to install language pack in order to be able to specify term labels for different languages. On the picture above English language is selected. In order to add more languages select Managed metadata services root node in the left tree in the term store and in “Working languages" select “Other locales”. After that it will allow to add all available locales regardless of installed language packs:

image

In the example above I’ve selected Russian language, although I don’t have Russian language pack on my dev env. After that on the General tab of the navigation term Russian language will be shown:

image

Custom sort tab allows to specify sorting order of the navigation terms in the navigation controls:

image

If you remember from 1st part it is possible to change order of navigation terms using WYSIWYG editor and drag and drop. Custom sort tab contains duplicating functionality, which is less convenient, but will work of WYSWIG editor won’t work because of some reason (e.g. if custom controls are used).

Navigation tab contains navigation settings for the term. This is one of the important tabs in context of our subject:

image

“Navigation Node Title”, “Navigation Hover Text” and “Visibility In Menus” settings are quite obvious. “Navigation Node Type” is quite interesting. It determines will users see friendly URL when they will select the current term’s node in navigation or not. As shown on the picture above option “Term-Driven Page with Friendly URL” is used for that. If we would change it to “Simple Link or Header”, then users will see well known “old” URL in the browser address bar.

URL can be specified manually or using standard asset picker. If you specify URL manually you can type everything, including URL which points to external site or to another site collection or sub site within current web application. When you specify URL via asset picker, then you may only select pages from current site and its sub sites.

Another interesting setting is Associated folder. Description of this setting is quite straightforward:

“Pages in this folder will be associated with this navigation node. When you navigate to one of these pages, this navigation node will appear selected in navigation menus, unless that page is already a target page for another navigation node in this term set.”

For testing I’ve created Products sub site and set it to the Associated Folder property of Company term. After that if I go to any page on Products sub site “Company” navigation node was selected:

image

Term-driven pages tab contains settings, which allow to configure friendly URLs for the term (and some other settings, related with Catalog publishing – this is another new feature, which I will describe in separate posts):

image

“Configure Friendly URL for this term” option allows to overwrite default friendly URL which is created by Sharepoint automatically based on the term’s title. “Target Page Settings” settings allow to specify the real physical page which is loaded when user navigates to the current term’s friendly URL. I.e. by default after navigation term set has been created, when user will click on any navigation node, he/she will go to appropriate friendly URL, but as there are no any real page behind it, user is redirected to standard “Page not found” page (PageNotFoundError.aspx). But if we create e.g. regular publishing page /pages/company.aspx and then will specify it in “Change target page for this term”, then user will see this page when will click Company link in the navigation:

image

I.e. it is kind if standard URL rewriting in Sharepoint.

Also on “Term-driven pages” tab it is possible to specify target URL of the children terms of the current term using “Change target page for children of this term”. It will be possible to override this URL for each children term by editing properties of this children term.

In “Category image” setting it is possible to specify image for this term which then can be displayed using Term Property web part. “Catalog Item Page Settings” are used in conjunction with cross-site publishing and catalog settings. I will write about them in separate posts. Managed metadata navigation and friendly URLs are great features by themselves, but with cross-site publishing and catalogs, it is even more powerful.

Custom properties tab is the last tab in the term settings:

image

It is kind of property bag of the term. It allows to add different properties and then use them e,g, in OTB Search item reuse web part, which is used on the Catalog item pages with cross-site publishing. But of course it is not the only application of these properties. You may store any additional information in these properties even if you don’t use managed metadata navigation. “Shared properties” can be used in all reused or pinned instances of the current term in the term store, while “Local Properties” are available only for the current term.

This was second part of my overview. In the next third part of the overview I will show some dynamic behaviors for managed metadata navigation.

No comments:

Post a Comment