Tag Archives: master page

Using a DOCTYPE in SharePoint 2007

While SharePoint 2007 certainly moved the platform forward for its time, there is no doubt that doing UI work with the CMS is nothing short of excruciating. The reason for this is (a) really, really bad markup and (b) no DOCTYPE (SharePoint Designer doesn’t help the cause either).  There is a lot you can do to deal with the first issue, but you’re largely stuck on the second.

The reason adding a DOCTYPE is problematic is because adding the DOCTYPE to the master page makes core functionality break like moving web parts between zones, and all the default styles are not made to work in browser’s standards mode. The best way to get around this would be for the DOCTYPE only to show when the page is in “display” mode but not in “edit” mode. (If you need to develop custom master pages for the “System Master Page” then I would not suggest using this solution because it will cause more heartache then it’s worth.)

To do this we need to include a content placeholder at the top of the master page.

<asp:ContentPlaceHolder id="DoctypePanel" runat="server" />

Then, in our layouts, we can include the following EditModePanel that will only output what we have in display mode. Keep in mind that all attributes are necessary to include. It would be nice if we could just include the code block belowin the master page, but it doesn’t work (I presume because it isn’t in the form tag).

<asp:Content ContentPlaceholderID="DoctypePanel" runat="server">

<PublishingWebControls:editmodepanel PageDisplayMode="Display" SuppressTag="True" 
runat="server" id="doctypeedit">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

</PublishingWebControls:editmodepanel>

</asp:Content>

Add this CSS to fix alignment on the site actions menu.

.ms-MenuUILabel {
	text-align: left;
}

Thanks to Carlos Fernandez for working through this with me.

UPDATE: Turns out I needed an addition content placeholder to include the X-UA Compatibility Meta Tag. If I didn’t include it I had issues with the browser mode changing effectively. You can’t reuse the same content placeholder because the meta tag belongs in the head.

Default Header and Navigation on My Sites and Search Center

For reasons unbeknownst to me and other SharePoint practitioners the Microsoft team decided not to include the site collection navigation as well as the large header above it (contains site logo, title and description as well as the social buttons) in My Sites and the enterprise search center. I’m not going to go on about why I think this was a poor decision, but I wanted to provide you with master pages for both that establish consistency.

The process was simple. I just had to find the code that created the header and navigation and include it in the out-of-the-box master pages for My Sites and the search center (called mysite.master and minimal.master respectively). The search center will then look exactly like v4.master in the header region. The My Site master page has the custom bar above the ribbon, and you’ll notice the site collection title, site title and description are not in the header. The reason for that is that the mysite.master uses those placeholders elsewhere in the master page. For the sake of sticking with the out-of-the-box design I’ve kept the content placeholders where they were designated in mysite.master.

You can then add your custom CSS and JavaScript to the master page as well as any other changes you wish to do. It will at least give you a start on interface consistency between the three major aspects of the SharePoint interface. The ZIP file contains both master pages including a text file with the code I placed into each of the master pages for reference.

Download Master Pages

unbeknownst