About page layouts
A 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.
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.
For more information, see Overview of the SharePoint 2013 page model, and How to: Create a page layout in SharePoint Server 2013.
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.
For more information, see Overview of the SharePoint 2013 page model.
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.
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.
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:
- From the Site Settings menu, select Site contents.
- On the Site Contents page, click Pages.
- In the Pages library, on the LIBRARY tab, click Library Settings.
- On the Settings page, click Versioning settings.
- In the Require Check Out section, for Require documents to be checked out before they can be edited, select No.
We are now ready to create our two new pages.
To create a new page:
- On the Site Contents page, click Pages.
- In the Pages library, click the FILES tab, and then click New Document.
- 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.
After you click OK, the newly created page is shown in the Pages library.
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.
Our Pages library now contains two new pages: ContosoCategoryPage and ContosoCatalogItemPage.
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