0

We are using managed navigation to create friendly urls in our SP 2013 site collection (main site and subsites). Some of the friendly urls but not all are shown in the navigation for the users, but others are just being used to create a page at the friendly url. This is all working.

We are also using the navigation terms as tags on pages. On the tagged pages the terms are rendered with their guids, but not the friendly urls. We want to link the tags on the page back to the pages in the navigation. I found the following code that allows us to get all the terms in the CurrentNavigationTaxonomyProvider or the GlobalNavigationTaxonomyProvider.

var ctx = SP.ClientContext.get_current();
var web = ctx.get_web();
var termSet = SP.Publishing.Navigation.TaxonomyNavigation.getTermSetForWeb(ctx,web,"CurrentNavigationTaxonomyProvider",true);
var terms = termSet.get_terms();
ctx.load(terms,'Include(Id,Title,FriendlyUrlSegment)');

We weren't using the current navigation (left side) in our site, so we put all the terms we needed lookups for in the "current nav" and this works. But now our design has changed and we need a current nav, but we still don't want to show all the pages in the nav.

If we uncheck Show in Current Navigation Menu then the code doesn't return results.

The terms I need are in the Global nav, but not at the top level, and getting results for global nav only returns the top level.

Is there a way to just get the friendly navigation terms from the termstore (or elsewhere) regardless of whether they show in the navigation?

Is there a way to get the entire global navigation termset which includes multiple levels down?

Is there some other way to say connect up "this is tag 63d23990-2cb7-40ef-8a32-ccc-882abe0f6 and it should go to page /site/friendlyname"?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.