Do you create a minimal master page?
v3.0
Posted at
20/10/2010 7:56 PM by
system
RuleContentTop
To create a master page or reuse an existing master page is a time-consuming process. Because you have to determine what the Office SharePoint Server 2007 page model requires — necessary content placeholders and controls to work with the page layouts.
Another problem of Default.master is that it contains many tables that are difficult to style.
Page Content
- <%@Master language="C#"%>
...
<HEAD runat="server">
...
<Title ID=onetidTitle>
<asp:ContentPlaceHolder id=PlaceHolderPageTitle runat="server"/>
</Title>
...
</HEAD>
<BODY scroll="yes” ... >
<form runat="server" onsubmit="return _spFormOnSubmitWrapper();">
<WebPartPages:SPWebPartManager id="m" runat="Server"/>
<table class="ms-main" CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="100%" HEIGHT="100%">
<tr>
<td>
<asp:ContentPlaceHolder id="PlaceHolderGlobalNavigation" runat="server">
<table CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="100%">
...
</table>
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
...
</tr>
<tr>
<td id="onetIdTopNavBarContainer" WIDTH=100% class="ms-bannerContainer">
<asp:ContentPlaceHolder id="PlaceHolderTopNavBar" runat="server">
...
</asp:ContentPlaceHolder>
</td>
</tr>
<tr height="100%">
<td>
<table width="100%" height="100%" cellspacing="0" cellpadding="0">
...
</table>
</td>
</tr>
</table>
<asp:ContentPlaceHolder id="PlaceHolderFormDigest" runat="server">
...
</asp:ContentPlaceHolder>
...
</form>
<asp:ContentPlaceHolder id="PlaceHolderUtilityContent" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat="server"/>
</BODY>
</HTML>
- Bad example - using default master page
So we recommend using the minimal master page which includes the necessary placeholders.
To create a minimal master page
- Open SharePoint Designer.
- On the File menu, click New, point to SharePoint Content, and then click the Page tab.
- Double-click Master Page to create a new master page.
- Click Design to show the master page in design view. You should see header and left margin areas and several content placeholders in the master page.
- Click Code to show the master page in code view.
- Copy the code from How to: Create a Minimal Master Page into the master page.
- <%@ Master language="C#" %>
...
<html>
<WebPartPages:SPWebPartManager runat="server"/>
<SharePoint:RobotsMetaTag runat="server"/>
<head runat="server">
<asp:ContentPlaceHolder runat="server" id="head">
<title>
<asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server" />
</title>
</asp:ContentPlaceHolder>
<Sharepoint:CssLink runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server" />
</head>
<body onload="javascript:_spBodyOnLoadWrapper();">
<form runat="server" onsubmit="return _spFormOnSubmitWrapper();">
<wssuc:Welcome id="explitLogout" runat="server"/>
<PublishingSiteAction:SiteActionMenu runat="server"/>
<PublishingWebControls:AuthoringContainer id="authoringcontrols" runat="server">
<PublishingConsole:Console runat="server" />
</PublishingWebControls:AuthoringContainer>
<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" />
<asp:Panel visible="false" runat="server">
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"/>
...
</asp:Panel>
</form>
</body>
</html>
- Good example - using minimal master page
- On the File menu, click Save As, provide a unique file name with the .master extension, and then save the file to the master page gallery (/_catalogs/masterpage) in your site collection.
Do you like this rule?
Do you follow this rule?