I was investigating ways how to provision a search centre site with all the configurations automatically. I tried to package all configurations from an already configured Search Centre using “Save site as template”, however it did not work as Publishing Features are activated in a Search Centre.
There are different configuration elements in a search centre site
- Search Navigation Settings
- Custom Search Display Templates
- Custom Search Results Pages which can be created using the function Add-PublishingPage
- Configure web parts in the search results page
- Refinement WebPart
- Search Results WebPart
This blog post focuses on updating the Search Navigation Settings. I have been experimenting using PnP method Add-SPONavigationNode. Prior to PnP September 2016 release, when the method was used, it was throwing the error message
Fortunately it was fixed with PnP September 2016 release.
I have created the method Update-SearchNavigationNode() to handle the update .
- The Search Navigation Nodes are retrieved using Id 1040
- All Existing Navigation Nodes are deleted using PnP method Remove-SPONavigationNode
- The Search Navigation Nodes are added using method Add-SPONavigationNode providing the values for parameters Title, Url,Location and Header.
Add-SPONavigationNode -Title "site directory " -Url "/search/Pages/SomePageName.aspx" -Location "SearchNav" -Header "SearchNav"