Configure properties of content search webpart

We will be following the export method for configuring properties of content search webpart.

Open the website in a browser, edit the page which contains webpart zones, next click on add a webpart.

Add content search webpart via webpart, edit the web part select the correct options, select display template -> control and set the correct option then inspect the select box and check the value of selected option, it will be a url, copy that url.step1-export

 

Repeat same process for display template attribute “Item”. Add content search webpart via webpart, edit the web part select the correct options, select display template -> item and set the correct option then inspect the select box and check the value of selected option, it will be a url, copy that url.step2-export

 

Next apply that webpart edit option and then export that webpart.

step2-1-export

Open that webpart and search for that url in xml code you will find like this below:

step3-export

Now you found the attribute name of attributes of Display Templates control and item which are “RenderTemplateId” and “ItemTemplateId”.

Next you can go to Sharepoint Designer create a new page layout, add webpart zones and inside webpart zones zone template add Content Search Webpart and add the following values to the code. You can see the image below for the code.

E.g.
RenderTemplateId=”~sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/Control_ListWithPaging.js”
ItemTemplateId=”~sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/Item_TwoLines.js”

  1. To add vlaue for Control- Go to the page layout and add the url as attribute value of the attribute “RenderTemplateId”step4-exportstep4-1-export
  2. To add value for Item – Go to the page layout and add the url as attribute value of the attribute “ItemTemplateId”
    ItemTemplateId=”~sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/Item_TwoLines.js”step5-exportstep5-1-export

Save the page layout. Next when you create a page in browser and apple the newly created page layout you will get the already 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