Edit Layout Pages to add Snippets from Snippet Gallery in SharePoint 2013

In Continuation with our Series on Creating and Editing Master Pages and Layout pages in SharePoint 2013, In this post we will look at how to use “Snippet gallery” and how to add Snippets for SharePoint Controls in Layout Pages using the design manager.

How to Edit Page Layout
In SharePoint 2013 for every Layout page two files – .aspx and html are Created by default.For making Changes to the Custom Layout, you need to download the html file of the layout page and make Changes to it. The modified html file is then saved back to the MasterPage Page gallery and the corresponding .aspx file gets updated automatically.

In our case below are two files created.
"SharePoint 2013 Custom Layout files"
 
To work with these files you can either navigate to the Master Page gallery of your site or you can download them by Mapping the MasterPage Gallery as a Netwrok drive .See the Step-by-Step tutorial on How to Map MasterPage Gallery as a Netwrok drive.
 
Once your download a copy of “Custom Page Layout.html” file( using ‘Download a Copy’ option in callup menu \ecb menu) you can simply add\remove the desired code snippets from the file and save it.
 
Lets look at an example of adding a SharePoint field Control copied from the new Snippet Gallery feature into our Custom Layout page.
 
By Definition -Snippet Gallery is a feature that lets you add SharePoint Components to your HTML or Master Page Design file. Users can select a component like Navigation or Search box from the Gallery and configure its properties. They can then copy the HTML snippet that’s generated and add it to the HTML design file\Master page. After you add SharePoint components to your HTML files, you can use CSS to fully brand them

To Open the Layout page in the Snippet Gallery click on the Custom page layout in Design Manager in “Edit Page Layout’s” list.See the screen below

"SharePoint 2013 Create Layout Page"

When you click on the layout you will be taken to the Preview page of your layout. Click on “Snippets” top right corner.See below

"SharePoint 2013 Snnipet Gallery"

Next in the “Page Field” select “Article Date” field.



Once you select the Field, a preview of the Field and the corresponding HTML Code gets displayed. Copy the HMTL code for this field to clipboard and add it to our Layout Page’s HTML. Open the Layout Page in an editor of your choice and paste the Copied Code in it.

 See below
"SharePoint 2013 Add Snippet"

Save the Page and upload it back to MasterPage Gallery.

Once the Layout is Updated you must Publish it again as a Major Version before using it.
"Page Layout Publish as Version"

Next Create a Page using the new Custom Layout (See Steps Here) or edit the existing Layout for a page.

Finally, Edit the page and View the Changes.Notice the “Article Date” field added to the layout of the page in the screen below.
"SharePoint 2013 Page layout"

1 comments:

Unknown said...

Great article, let me introduce you other way to add custom master pages to the SharePoint.

Bind Tuning have an online tool where you can fully customize a theme for SharePoint that includes several new masterpages, and a lot of features that are not available in the default themes.

Take a look at www.bindtuning.com and try it for free.

Post a Comment

Popular Posts