Wednesday, June 13, 2012

SharePoint 2010 Search – change the style of hithighlighting

I recently had to change the style of hit highlighting in the search center from the default bold style like testing to testing as it is being displayed in other search engines. It is very simple to accomplish this effect by going to the search results page and setting it in edit mode. Next click edit on the “Core Results Web Part”.

In the edit web part menu, under "Display Properties" uncheck "Use Location Visualization" and click on XSL Editor.


Copy and paste the XSLT into editor of your choice and locate the following section.

<xsl:template match="c0">

<strong><xsl:value-of select="."/></strong>


Replace it with:

<xsl:template match="c0">

<span style="background:#ffcc00"><xsl:value-of select="."/></span>


Save the page and you will notice the new style taking effect.


For the sake of consistency, perform the same steps for you people search results web part.

Enjoy :-)