Static SharePoint 2013 Navigational Menu from a Comma Delimited File (CSV) for Input

 


3-Level Metadata Navigation

Figure 1:  Demo of 3-Level Static Metadata Navigational Menu using SharePoint 2013 “Composed Looks”

 

The project does two things:

  1. The PowerShell Script Create-MetadataMenu.ps1 creates a 3-Level Static Navigational Menu in the SharePoint 2013 Termstore from a Comma Delimited File.
    (PublicMenu.csv may be used as a working example.) 
    If the “AlterforNewWindow” Switch is used, any urls with the NewWindow fields (L1NewWindow, L2NewWindow, L3NewWindow) set to 1 will have “/NWND.aspx” appended to the end.
    This necessitates applying the second part which is a jQuery delegate control which is added to the AdditionalPageHead Content PlaceHolder.
  2. The Project with the WSP, TopNavScriptingDelegate.wsp, will provide a jQuery delegate control to create a click event on all urls ending with “NWND.aspx”. The click event will shorten the Url and open it in a new window.

    (Don’t shoot the messenger-No fields in Navigational Metadata to make this happen.)

 

The PowerShell Script does the following:

  1.     Creates a Group if needed
  2.     Creates/Recreates a Navigational Termset
  3.     3-Level Menu of Titles and Links
  4.     Sorts Terms by order of entry--Not alphabetical like default
  5.     Optional Flag to Alter the Url
    (I would leave this flag off since it requires a WSP with jQuery to actually change the URL and open in a New Window. This option alters Urls to be opened in a New Window to end with "/NWND.aspx". The jQuery selects these strange urls and alters them in a click event.)

 

The Optimal way to run this is:

  1.     Create a New Site Publishing Site Collection (Nothing to lose and nothing to backup)
  2.     Change the Site Collection Navigation to Structural--so there is not competing demands on the  termset to be created or recreated.
  3.     Run the script as Administrator in PowerShell. The last line of the script runs the function and should be altered for your specifics
  4.     Run the script. (If recreating, I have seen contention and have had to go into the Termstore and manually delete the termset--then it should run fine.)
  5.     After completion switch the top-level to MetaNavigation, Locate the Termset and click Okay
  6. (rinse and repeat if you want to change the CSV).

 

Please kick the tires.