Sunday, April 21, 2013

Managed metadata navigation and friendly URLs in Sharepoint 2013 – part 3. Configure sub sites and pages

In this article I continue overview of the managed metadata navigation and friendly URLs features in Sharepoint 2013. In the previous parts (first and second) I described basic functionalities available in the standard UI. Now let’s see how managed metadata works during creation of sub sites and pages what is very important for content production.

Scenario 1. Create sub sites.

First of all let’s try to create sub site and configure managed metadata navigation with friendly URL for this sub site. Interface for creating sub sites is almost the same as in Sharepoint 2010:

image

In our example we will create sub site Products with the same URL. In the Navigation Inheritance set “Use the top link bar from the parent site” to Yes.

After creation will be completed we will be redirected to /Products sub site, but it won’t appear in the navigation: neither in current nor in global. This is first finding: Sharepoint doesn’t create navigation nodes for sub sites in the managed metadata navigation as it does in case of regular structural navigation. In order to show it here we need to go to Term store management and add new term manually (also we can add it via WYSIWYG navigation editor). It is important that new term will have “Navigation node type” set to “Term-Driven Page with Friendly URL” and that friendly URL will be the same as URL which we specified on new sub site page (Products in our case):

image

In this case term will be related with sub site automatically, i.e. Products will appear in the navigation and when we will go to this sub site, navigation node will be shown as selected:

image

The same will happen if we will create sub site of 2nd level, e.g. Products > Catalog. In this case we need to create Catalog term as child term under Products term:

image

After that it will be shown in the navigation:

image

Of course if we will delete sub site or will change URL via Site settings > Title, description and logo, we will need to sync these changes in term store manually.

Scenario 2. Create pages.

At first let’s create new page (e.g. with Legal title) on the root site of the site collection:

image

Sharepoint automatically shows friendly URL of the new page on the create page dialog. In the example above we can see that it will point to the root site, which is logical in this case.

After creating of the new page new Legal item will appear in the navigation automatically:

image

I.e. in opposite to the sub sites, Sharepoint creates navigation node for new pages automatically. Also it will automatically synchronize changes in Term store management if we will delete this page or change URL via Edit properties in the ribbon. Also if we will create new term and will associate it with some page on the root site manually Sharepoint also will automatically synchronize changes for it in the term store.

Ok, on the root site friendly URLs for pages work quite good. Now let’s create new page on the Products sub site which we created above. Go to Products sub site and click Site settings > Add a page. And here we face with the first problem: Sharepoint will create this page on the root site, not on the sub site:

image

Ok, although it is not so convenient for content producers, we can avoid this problem by creating the page on the sub site via Site manager. We need to choose sub site in the left tree view and then select New > Page from the toolbar:

image

After creating we will be redirected to the new page and will see regular not friendly URL in the address bar:

/Products/Pages/Info.aspx

Also navigation term won’t be created automatically. Let’s try to configure it by ourselves, i.e. to create new navigation term under Products and set URL of the target page manually:

image

New navigation node will appear in the navigation, but when we will click on it we will get “Page not found” error:

image

This looks like a bug in the managed metadata navigation: friendly URLs work for the pages on the root site, but doesn’t work on sub sites, except site welcome pages (for welcome pages friendly URLs work on all levels).

At the current moment we found the following workaround: we need to change sub site URL so it won’t equal to the friendly URL of the associated navigation term. In our example we need to change URL of the Products sub site from /products to e.g. /products-site. After that we need to manually set the target URL for Products term to the /products-site/pages/default.aspx:

image

and fix target URL for the all sub terms, including term which corresponds to our page Info.aspx. After that friendly URLs become working for the pages on sub sites. However you still need to use Site manager for creating the pages, because Sharepoint will still create pages on the root site when you will select Site actions > Add a page. The good thing is that synchronization with term store will still work with this solution, i.e. if we will change URL of the page on the sub site or delete it, changes will be synced with term store automatically.

Summarizing, it seems like that there are 2 bugs in the current implementation:

  1. When you create a page on sub site when use managed metadata navigation with friendly URLs via Site settings > Add a page, Sharepoint creates it on the root site.
  2. Friendly URLs for all pages on the sub sites, except welcome page (default.aspx), don’t work if the real URL of the sub site equals to the friendly URL, configured in the navigation term settings. In order to make it work we need to change site URL (e.g. by adding “-site” suffix) and configure navigation term sets’ target URLs manually.

We created support ticket from MS about these problems, will update when/if we will get some news about them. Hope that this information will help you when you will deal with managed metadata navigation.

16 comments:

  1. Any luck about this bug? I just discovered this as well.

    ReplyDelete
  2. no updates. We use mentioned workaround with real URLs which differ from friendly URLs.

    ReplyDelete
  3. I'm trying to make use of the new metadata navigation in SP 2013. It works great for the global navigation.
    For the current navigation, our site design calls for only displaying the nodes starting from the current node.

    I have tried this:


    Shouldn't this display from the current node down?

    ReplyDelete
  4. This is what I tried:

    PublishingNavigation:PortalSiteMapDataSource SiteMapProvider="TaxonomySiteMapProvider" ShowStartingNode="false" id="QuickLaunchSiteMap" StartFromCurrentNode="true" runat="server"

    ReplyDelete
  5. did you also tried to change properties of AspMenu control?

    ReplyDelete
  6. Thank you very much for the overview.

    Disappointing bug though. For my clients I believe it disqualifies the feature completely :-(

    Any chance it's been fixed in the latest CUs? Anyone tested this?

    ReplyDelete
  7. soerennielsen,
    yes our customers also were not happy with it, but it was ok for them to go with friendly urls with mentioned workarounds. We tested it with April CU, the problems were still there and no news from MS support.

    ReplyDelete
  8. great post - validated the workaround albeit a bit of a stretch for real time production setup.

    ReplyDelete
  9. Greetings,
    I am currently running into an issue which is similar to what you described.
    As you suggested, I did create a new page in a subsite using the Content and Structure. I then added this page as term
    after which I was able to view on the site and was able to access it.
    Now I move this term (the new page) to a different location after which I force the Taxonomy Update Scheduler to run
    and then try to access the page in its new location. I get a 'Page not found' and the url is same as what you posted above.
    When I move the term (the new page) back to its first location, it works.
    Whats the workaround to get this working?

    ReplyDelete
  10. Daniel,
    I didn't fully understand your case. Each detail here is important, so provide please examples of real and friendly urls of the page (is it created on the sub site or on root web of site collection?) and hierarchy level of the term before and after moving.

    ReplyDelete
  11. Hello, thanks for the great article. Are there any news on these two bugs?
    And do you have found a solution to only show the childs of the current selection within the current navigation. So far, SharePoint always shows to whole current navigation nodes... :(

    ReplyDelete
  12. Pascal hi,
    we didn't get any news from MS support and I think there won't be any, i.e. mentioned workarounds is best what we have at the moment.
    About problem with left navigation: settings specified in Site settings > Navigation are ignored when managed metadata navigation is used. For this we used another workaround: always show whole navigation hierarchy (you will need to change site map data source parameters for this, i.e. increase number of statically displayed levels) and show/hide navigation nodes by javascript.

    ReplyDelete
  13. Hello, any new findings or further suggestions? Managed Navigation seems pretty inconsitent...

    ReplyDelete
  14. KGS hi,
    nothing special except confirmation of the problems described in this article from other people and projects.

    ReplyDelete
  15. If I created a deparements term with term children one and two, term one works fine but term two fails. Any one else?

    ReplyDelete
  16. Hello Alexey Thank you for this great articles
    I have used the managed navigation, When using the "Content Query Webpart" for displaying news pages list, when clicking any news item it goes to the long URL that includes /Pages/ and .aspx extension , How to set configuration in the Content query web part to redirect the items to the friendly URL ?

    ReplyDelete