Configure criteria of content search webpart

The first step is to open site in sharepoint designer. Create a page layout and add a webpart zone first. It will look like this as given below:-

<WebPartPages:WebPartZone id=”g_F65E9C0D6A9E4BE49A9112742242B0E0″ runat=”server” title=”Right Row”><ZoneTemplate>

</ZoneTemplate></WebPartPages:WebPartZone>

Add content search webpart inside zone template via teh top menubar in sharepoint designer.

Apply the page layout to a newly created publishing page. Edit the page, configure the webpart that comes automatically as it is added in page layout. Configure search criteria settings:-

criteria-1

Save the page. Apply the webpart click ok. Page goes back to edit mode, click on export.

criteria-2

Open the exported file in the xml you will find the “DataProviderJSON” property. Copy that value which is a json.

criteria-3

Open html escape online utility:- http://www.freeformatter.com/html-escape.html#ad-output and escape this JSON value.

criteria-4

Replace the DataProviderJSON value in page layout with this escaped html. It will look something like below.
<WebControls:ContentBySearchWebPart runat=”server” AlwaysRenderOnServer=”False” ResultType=”” DataProviderJSON=”Escaped JSON” ……..>

</WebControls:ContentBySearchWebPart>

Save the page layout. Next time you create a new page with the above page layout, the page will have a pre-configured content search webpart.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s