How to add BreadCrumbs to Smart Search Results

   —   
This article describes how to add BreadCrumbs to the Smart Search Results transformation, so each search result will shows where the document originates from.
You will need to add the code below to the current transformation which is used for the Smart search results.

<cms:CMSBreadCrumbs runat="server" ID="resultBreadcrumb" ShowCurrentItemAsLink="true" EncodeName="true" StopProcessing="true" Path='<%# GetSearchValue("NodeAliasPath") %>' />

<script runat="server">
protected void Page_PreRender(object sender, EventArgs e)
{
resultBreadcrumb.StopProcessing = false;
resultBreadcrumb.ReloadData(true);
}
</script>


Using the Corporate Site as an example for this article, please find the Smart search dialog with results web part located in Special Pages -> Search, and edit the web part properties.  Once the dialog window opens, find the “Transformation name*:”, click “Edit”, and a new window will load with the current transformation code.  Once the transformation window opens add the example code in this article to your existing code, click save, and execute a search to test this functionality. 

The first screenshot is an example of how to add this code to directly to your selected transformation, while the second screenshot shows the results of adding this code.

Search_Breadcrumb_Screen.png

Search_Breadcrumb_Screen_2.png
-eh-


See also: Smart search transformations

Applies to: Kentico CMS 6.x
Share this article on   LinkedIn