Static SharePoint 2013 Navigational Menu from a Comma Delimited File (CSV) for Input
The project does two things:
- 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.
- 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:
- Creates a Group if needed
- Creates/Recreates a Navigational Termset
- 3-Level Menu of Titles and Links
- Sorts Terms by order of entry--Not alphabetical like default
- Optional Flag to AlterUrl (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:
- Create a New Site Publishing Site Collection (Nothing to lose and nothing to backup)
- Change the Site Collection Navigation to Structural--so there is not competing demands on the termset to be created or recreated.
- Run the script as Administrator in PowerShell. The last line of the script runs the function and should be altered for your specifics
- 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.)
- After completion switch the top-level to MetaNavigation, Locate the Termset and click Okay
(rinse and repeat if you want to change the CSV).
Please kick the tires.
Atachment Figure 1 3-Level Static Menu on SharePoint 2013 using Composed Looks