Creating custom search results pages in SharePoint Online

January 30, 2020
The original article is published on the Microsoft Tech Community Delve Blog.

We’re excited to announce that you can now create custom search results pages in SharePoint Online, extending the benefits and flexibility of Microsoft Search so you can make it your own.

 

With custom results pages you can create a new page that can be used to control the layout and design of search results to support your custom needs and now use open-source search web parts from SharePoint Patterns and Practices community, as well as any custom web parts that you may have developed using SharePoint Framework. 

 

clipboard_image_0.png

PnP modern search web parts

 

Custom search results pages with SharePoint Online will be displayed when searching through the native search box, instead of the out of box search results page.

 

NOTE Custom results pages will only be displayed when searching through the modern search box(Microsoft Search).  This capability is rolling out WW.  A visual queue that Microsoft Search is available in your tenant is the move of the search box from the app or service canvas to the suite navigation bar (header).

 

clipboard_image_1.png

Modern search box in the suite navigation bar

 

The custom search results page will be used in the same scenarios that were showing the site search results page (when you enter search from site pages, or the home page of the site for example). It will not be in effect when you are searching within a listlibrary or the site contents page.

 

You may use the link to expand your search from search results in these experiences to get to the custom results page.  

 

To configure a custom results page in SharePoint Online follow the steps below:

 

  1. Browse to the site where you would like to configure a custom results page and select Site Collection Settings, Search Settings.
  1. In Search Settings, choose to “Send queries to a custom results page”, and provide a value for Results page URL: and save your changes.

 

clipboard_image_2.png

Configuring the custom results page in SharePoint

 

Optionally you can use PnP-PowerShell to configure the custom results page as follows:  

 

 

 

Set-PnPSearchSettings -SearchPageUrl “https://tenant.sharepoint.com/…”

 

 

 

Learn more about this command at https://github.com/SharePoint/PnP-PowerShell/blob/master/Commands/Search/SetSearchSettings.cs.

 

NOTE The custom results page needs to be on the same domain as your site, but doesn’t have to be in the same site collection.  

 

In addition to this update, we’re also introducing a new page layout for custom search results pages that can optionally be used to make the search results page appear closer to our out of box search results experience. This new layout can only be active for the pages that are set to be the custom search results page. 

 

To learn more about custom results page, check out our Ignite 2019 Search Customization and Development session and bookmark Microsoft Search on YouTube at https://www.youtube.com/channel/UC-d4Q5pvRf6IVJuWY8wpAFw/.

 

Resources

For open source projects, getting started with our Microsoft Search APIs, and more customization and extensibility samples, visit Microsoft Search on GitHub at https://github.com/microsoft-search.

 

Keep up to date with Microsoft Search on our resource center at https://aka.ms/microsoftsearch and follow us on Twitter @MicrosoftSearch.

 

If you would like to leave feedback to our teams on Microsoft Search visit https://microsoftsearch.uservoice.com.  We’re listening!

Discuss this article in the Microsoft Technical Community.