I've been looking online at a bunch of MSDN examples of how to programmatically build and then set Metadata Navigation through feature recievers. The sample code MSDN gives you is as follows:
NavigationTermSet navTermSet = NavigationTermSet.GetAsResolvedByWeb(termSet, web, StandardNavigationProviderNames.GlobalNavigationTaxonomyProvider); navTermSet.IsNavigationTermSet = true; navTermSet.TargetUrlForChildTerms.Value = "~site/Pages/Topics/Topic.aspx"; NavigationTerm term1 = navTermSet.CreateTerm("Term 1", NavigationLinkType.SimpleLink); term1.SimpleLinkUrl = "http://www.bing.com/"; NavigationTerm term2 = navTermSet.CreateTerm("Term 2", NavigationLinkType.FriendlyUrl); NavigationTerm term2a = term2.CreateTerm("Term 2 A", NavigationLinkType.FriendlyUrl); NavigationTerm term2b = term2.CreateTerm("Term 2 B", NavigationLinkType.FriendlyUrl); NavigationTerm term3 = navTermSet.CreateTerm("Term 3", NavigationLinkType.FriendlyUrl);
As a simple example. This is nice, however I can't fully comprehend how the
FriendlyUrl terms work. For instance, how do I set a custom FriendlyURL path (such as
/community-blog) for a term? How do I set the path the term should re-direct you to (such as
~site/blog/CustomHomePage.aspx)? I want to utilize the friendly URL naming but can't figure it out from what's documented on MSDN. Has anyone figured it out? As a workaround, I'm currently creating all
SimpleLinks and setting their
SimpleLinkUrl property, but that doesn't let you set a custom friendly URL as far as I know.