How to Create Minimal Web Pages in SharePoint

This brief article talks about how to create minimalistic pages in SharePoint without deploying any server-side code, and with minimum effort by using only SharePoint Designer. By minimal web pages, here I mean master page and web pages that have only bare bones with essential web part zones, without any additional HTML markup for header, footer, left-navigation, or additional server-side controls (such as, site actions, search box, etc.).

Please note, even though this post is about SharePoint 2007 implementation, very similar technique is applicable to SharePoint 2010 as well, with changes to the content of the master page mostly.

1. Create a minimal masterpage with SharePoint Designer following this MSDN article: How to: Create a Minimal Master Page.

Basically, it all comes down to creating a file in SPD, which we are going to call msminimal.master, under your site’s http://site / _catalog / masterpage (Master Page Gallery). That msminimal.master must contain only essential empty zones, and no client-side markup or server-side controls.

My only changes to the master page from MSDN article would be adding Visible=”false” attribute to Site Actions and Welcome if you would like to hide them in your future web pages:

      <wssuc:Welcome id="explitLogout" runat="server" Visible="false" />
      <PublishingSiteAction:SiteActionMenu runat="server" Visible="false" /> 

 

2. While in SharePoint Designer, create a new web aspx page and reference your new master page changing MasterPageFile attribute from ~masterurl/default.master to _catalogs/masterpage/msminimal.master.

Here is an example of the simplest web page with just one web part zone:

<%@ Page language="C#" MasterPageFile="_catalogs/masterpage/msminimal.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" meta:progid="SharePoint.WebPartPage.Document" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
  <WebPartPages:WebPartZone runat="server" FrameType="TitleBarOnly" ID="MainZone">
    <ZoneTemplate>
    </ZoneTemplate>
  </WebPartPages:WebPartZone>
</asp:Content>

3. Now if you want to edit your new custom web page visually in a browser and add web parts, you would need to use one old non-documented trick. Since there is no familiar header or site actions menu, you need to type in your Internet Explorer the following URL, in order to switch between view and edit mode, and back :

javascript:MSOLayout_ToggleLayoutMode();
(Refer to my previous article on highly useful non-documented shortcuts http://www.artykul8.com/2011/03/useful-sharepoint-shortcuts/)


4. After adding all necessary content to your custom web page, it contains only content and no additional header, footer, etc. This sometimes comes extremely useful if you want to display some specific content in a Page Viewer Web Part on another SharePoint site, or in a frame in another non-SharePoint web application.

Leave a Reply

Your email address will not be published. Required fields are marked *