August 6, 2012

Master Pages, Page Layouts, and Content

One of the key concepts to understand in the SharePoint world, especially when it comes to branding, is how a fully rendered web page in the browser is assembled? The key components to understand are master pages, page layouts, and (of course) page content.

Master Pages
Master pages are located in the Master Page Gallery for a site collection. They are used to define the very basic structure for (nearly) all pages in a site. The layout as defined by a master page might be as simple as "header, body, footer" and the individual components might include things like a company logo, search box, login form, and/or copyright notice.

Page Layouts
Page layouts are associated with content types, and are therefore used to define a specific layout for displaying the data that belongs to their type. For example, you might have a "News Article" layout that defines the specific layout of the headline, tagline, date, author's name, body text, and list of related articles. This content would fit within one of the placeholders set by the master page.

Page Content
Your actual content typically lives on its own, independently of any presentation layer, within a SharePoint list. In the "News Article" scenario, you'd simply have a custom list full of individual items containing the headline, author, text, etc. That said, it is also possible to skip the page layout altogether and simply write a .aspx page that references a master page directly.

When content is requested, the master page (with search and other controls) and page layout (with field controls, web part zones, etc.) are each retrieved and rendered, and the bits of the page layout are plugged into the content placeholders defined by the master page. The combined page is then displayed for the user. Voila!

If you're interested in more technical details, you visit this MSDN page on the SharePoint Page Processing Model.

No comments:

Post a Comment