Sunday 19 January 2014

Upload page layouts and create new pages in a publishing site

About page layouts
page layout is a template for a page in your site. This is where you define the layout and structure for the body of a page.
Page layouts contain page field controls and Web Part zones. Page field controls and Web Part zones are placeholders that define where content can be added by authors. They are added to a page layout at a specific position, for example on the left side of a column, and with specific style elements, such as bold.
SharePoint page layout
In my previous blog post, I explained how SharePoint Server 2013 automatically converts an HTML master page into an ASP.NET page. The same rule applies to page layouts - you can create a page layout in HTML format, and SharePoint Server 2013 will automatically convert it into an ASP.NET page for you.  This means that when you design your page layout, you can do this in your favorite HTML editor, focus on HTML, CSS and JavaScript, and you don't have to worry about ASP.NET or SharePoint-specific markup.

About pages and rendered pages
It is important to understand that authors do not add content to a page layout.  Content is added to apage
A page is created based on a specific page layout. Once you've created a page, authors can add content that they want to display on their website to the page. Because the page is based on a page layout with page field controls and Web Part zones, authors cannot add content outside of these areas.
When visitors browse a site, they will see a rendered page. In a rendered page, the master page is merged with the page layout, and the content for the page is displayed in the page fields and Web Part zones.
SharePoint rendered page
For more information, see Overview of the SharePoint 2013 page model.

How to upload a new page layout
In our Contoso scenario, we have two page layouts; one for the category page, and one for the catalog item page.
In my previous blog post, I showed you how to map a network drive. Because we have mapped our network drive, uploading these page layouts becomes very easy. Simply drag and drop the files into your Master Page Gallery.
Drag and drop page layouts
In SharePoint, refresh the Master Page Gallery page to see that the two page layouts have been added. Also notice that an associated ASP.NET file has been created for each of the page layouts.
Master Page Gallery

How to turn off versioning for the Pages Library
In our scenario, I am not using SharePoint workflows for approval. My files have already been approved, so before I create a new page, I want to turn off versioning for the Pages library.
To turn off versioning for the Pages library:
  1. From the Site Settings menu, select Site contents.
Site contents
  1. On the Site Contents page, click Pages.
  2. In the Pages library, on the LIBRARY tab, click Library Settings.
  3. On the Settings page, click Versioning settings.
  4. In the Require Check Out section, for Require documents to be checked out before they can be edited, select No.
Library versioning settings

We are now ready to create our two new pages.

How to create a page based on a page layout
To create a new page:
  1. On the Site Contents page, click Pages.
  2. In the Pages library, click the FILES tab, and then click New Document.

Upload New document
  1. On the Create Page page, enter a Title and a URL name. From the Page Layout list, select the page layout that you want to apply to the new page. In our scenario, the page layout is the  newly uploaded page layout called ContosoElectronicsCategoryPageLayout.
Create category page
 After you click OK, the newly created page is shown in the Pages library.
Category page created
In our Contoso scenario, we will also need a catalog item page. To create this page, I repeat steps 3 and 4 from the previous procedure, however for Page Layout, I selectContosoElectroniceCatalogItemPageLayout.
Create catalog item page
 Our Pages library now contains two new pages: ContosoCategoryPage and ContosoCatalogItemPage.
Catalog item page created
Now that we have created these pages, the next step is to assign them to the terms that drive our site navigation.

No comments:

Post a Comment