Website Search
Created by Orckestra
How to add Website Search to your website
You can have two approaches to implementing search on your website:
- Having a dedicated page for the search. This page will feature the search box and show search results.
- Having a page only for search results while using the search box throughout the website (via the page templates).
For both approaches, do the following:
- Create or edit the page you will use for the search results.
- Insert the Orckestra.Search.WebsiteSearch.SearchResults function ( Insert > Function), or add the following code:
Expand code - If necessary, specify its optional parameters:
- Show Search Form: If 'True', the search box will be also shown ('True' by default).
- Search Form Button Label: The text to show on the search form submit button. When left blank, a generic search icon is used. (Blank by default.)
- Current Site: If selected ("True"), search is only limited to the current site / branch. ("True" by default).
- Page Size: The number of search results per page ("10" by default).
- Show Highlights: If 'True',search results will have keyword highlights shown below the title.
If you choose to have a dedicated page for search, keep the default value ('True') in the "Show Search Form" parameter.
If you choose to only show results on a dedicated page, and have the search box on all the pages of your website, set the "Show Search Form" parameter to 'False' to hide the search box on the search results page, and take the following steps:
- Edit the template(s) used with the pages on your website.
- Insert the Orckestra.Search.WebsiteSearch.SearchForm function ( Insert > Function Markup), or add the following code:
Expand code - Specify its required parameter:
- Search Result Page: The page where the search results will be displayed (see above).
- If necessary, specify its optional parameter:
- Search Button Label: The text to show on the search form submit button. When left blank, a generic search icon is used. (Blank by default.)
Searching in custom data types
To enable content search for custom a data type, one has to
1) Make the data items of the type linkable by enabling internal URLs.
2) Provide public URLs for the data items, f.e. by having a razor function with RoutedData<TDataType> parameter.