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>
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:-
Save the page. Apply the webpart click ok. Page goes back to edit mode, click on export.
Open the exported file in the xml you will find the “DataProviderJSON” property. Copy that value which is a json.
Open html escape online utility:- http://www.freeformatter.com/html-escape.html#ad-output and escape this JSON value.
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” ……..>
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.