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.
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.
Next apply that webpart edit option and then export that webpart.
Open that webpart and search for that url in xml code you will find like this below:
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”
To add vlaue for Control- Go to the page layout and add the url as attribute value of the attribute “RenderTemplateId”
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”
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.
The following blog post follows steps to be followed to get started with Creating master pages and page layouts with design manager in sharepoint 2013/Office365.
I have created master pages and page layouts in Office365 using design manager. It follows a step by step details and by the end of the blog you will have your own demo blog site template ready which uses master page and page layout.
I have replicate the Bootstrap blog template that is available over here.
activate features to enable design manager Site collection administration-> Site collection features->sharepoint server publishing infrastructureSharePoint Server Publishing Infrastructure (under Site collection features) Site action-> Manage site features->sharepoint server publishing.SharePoint Server Publishing (under Manage Site Feature)
Open the site collection and upload the masterpage html document.
Also upload the files under style library folder, check out, check in and publish them as a major version.
Open sharepoint designer upload our html file under _catalogs/master pages. You will find it under All Files->_catalogs->masterpages.
Create required folder structure and upload the remaining files. Follow the same checkout, check-in and publish process for rest of the files. Usually the resources go under Style Library but in this demo we create it under Masterpage library itself.
Go to design manager, click on convert file to master page. Browse and select our html document.Select blog.html. After that click on insert.
It will automatically create another file with same name and extension as .master. The changes made in html file are synced to the master page automatically. You can now go to SP Designer refresh the site and see the changes.
Open the master page in SP designer, edit it and make the necessary changes.
Remove the markup of page layout from html page with a div attribute data-name=ContentPlaceHolderMain. You will see code something like below that is selected by user. Place this code inside container div.Save it checkout, check-in and publish as a major version.
Next step to create a page layout. Select edit page layout option in left nav then the create a page layout.Select the master page and default content type.Click on the layout name and open the preview.
Open layout in sharepoint designer. You will see two pages with same page layout name. Edit the html page.
Inside the tags of ContentPlaceHolderID with ID as PlaceHolderMain you will find html markup with some sharepoint code.
These are preadded webparts by default in the page layout, we will delete them and add our own html markup for our page layout.
Take out the not required text and snippets and keep only the structure we want to keep for our page layout in which we will copy paste the web part zone.
Visit our Design manager under page layout section click on the page layout that we created.
On the top right we will see snippets option link. Next open the snippets link which opens a new page, there we will get the web part zones that we will copy to insert in our page layout later.
Copy paste the web part zones from the below copy to clipboard button. Rename the ids after pasting it in the html markup. Web Partzones must have unique id.Changing the html markup of the page layout keep sync with the page layout “.aspx” page. Check out, check in the page and publish it as a major version.
Next up create a new page. You can hover on site settings menu, click on add page, it adds below the pages path. You can also select the page layout at this page.Or
Click on created page and then edit that page. Select page tab and next page layout to select that page layout. Check in the page.
Visit site settings and click on master pageSelect the master page and click save
Edit the page it will take the applied master page and page layout.
You can now add webparts. Go ahead, add few content editors and text inside it.
Add some text in it, save it.
This is how it looks finally
Note: In case you encounter any errors or issues check if both the publishing features are active or disable and reactivate it.
We often come up with a requirement that the specific page require banner images, for example the default landing home pages. The most common requirement is that of carousel on the home page.
The general approach is to create page layouts for different design patterns. Below I am mentioning another approach to implement it.
Add an empty contentplaceholder in the master page.
In master page we set an ID in the contentplaceholder tag. This ID will be mentioned in the page layout where we insert content tag. This will insert an empty div into the html page that will be generated.
If you wish to add banner images or carousel we will add the following code in page layout, eliminating the need for another page layout specifically only for banner images or carousel images.
Add content tag in the page layout with the html markup.
Next when we visit the page with above mentioned code present in master pages and page layout respectively. The page will display “Sample text”.
In a publishing site we have a master page that all the pages inherit. We can edit a page and assign page layouts through the page layouts options on top ribbon. It lists out all the page layouts are available. For a page layout to be available it should be checked in and published.
In current case where we want a single page layout to inherit a different master page other than the custom masterpage that is currently set. Usually setting a master page for a page is done as listed below.
But this alone is not enough, if also need few more things to set in the page layout.
Add a page and assign the page layout. Open the site in sharepoint designer, visit pages section where the page is saved and deattach the page layout from the page.
Next edit the page and remove the references of custom master page (custom.master) from the page.
Usually when i want to set the page as home page i visit the page URL and open the top navigation bar by clicking the Page option and select the option Make Homepage.
There is also another way to set set the page as home page visit the Site Settings, Site Welcome Page, browse to the destined location select the page and click ok to set it as defalt welcome page or landing page of your site collection in sharepoint.
I wanted to set is through code, via the visual solution, publish the solution activate the feature and you are good to go. In your Visual Studio Solution you will find PropertyBags something like this.
Open the Elements.xml and add the following code and specify the landing page. Home.aspx in the below example.
I had just installed a fresh copy of Visual Studio 2012 and i also installed the latest Update 4. I tried to open my Visual Studio solution in it. I gave me a message project type not supported message.
It tried creating a new sharepoint project but it was missing, which must usually visible like in the below image
What i found out is that we need to install Microsoft Office Developer Tools for Visual Studio. It is an add-in for Visual Studio that enables developers to create, build, debug, run and publish apps and solutions for Office and Sharepoint. The Web Platform Installer usually installs it for you.