Page Layouts, Breadcrumbs, and the space above the main content area of a page.

Previously, I’ve blogged about some of my investigations into how breadcrumbs work in SharePoint – and how sometimes they’re shown in the ‘Page Title Area’, and sometimes they’re put into the ‘Main Content Area’.

One of our customers was building a page layout, and wanted the breadcrumbs inside the Main content area. They put the following content controls into the page layout file:

<%-- This content tag blanks the 'title' placeholder, which is above the white 'main content area' of a page --%>
<asp:Content ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" />

<%-- This content tag blanks the 'title breadcrumbs' placeholder, which is above the white 'main content area' of a page --%>
<asp:Content ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server"/>

<%-- This is the main content for a page. This content tag is an example only.
Usually there is more formatting and web part zones, other controls, etc.--%>

<asp:Content ContentPlaceHolderID="PlaceHolderMain" runat="server">

<!-- This tag defines the breadcrumb to display. On a normal page (such as defaultlayout.aspx) it is a contained within a table -->
<asp:SiteMapPath ID="ContentMap" Runat="server" SiteMapProvider="CurrentNavSiteMapProviderNoEncode" RenderCurrentNodeAsLink="false" SkipLinkText="" NodeStyle-CssClass="ms-sitemapdirectional"/>

<!-- This tag displays the text of the page's 'Title' that is given when it is created. -->
<SharePoint:FieldValue id="PageTitle" FieldName="Title" runat="server"/>

</asp:Content>

Unfortunately, this resulted in a gap between the top of the page content area, and the bottom of the top navigation:

Page Layout Gap

So, what was missing?

Well, it turns out that another couple of content controls are relevant:

<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server"><IMG src="/_layouts/images/blank.gif" width=1 height=1 alt=""></asp:Content>

<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
<style>
TD.ms-titleareaframe, .ms-pagetitleareaframe {
height: 10px;
}
Div.ms-titleareaframe {
height: 100%;
}
.ms-pagetitleareaframe table {
background: none;
height: 10px;
}
</style>
</asp:Content>

The first content tag blanks the ‘page icon’ placeholder, which is above and to the left the white ‘main content area’ of a page. It is set to show a 1 pixel transparent image, and it appears that this is to maintain page structure, where setting the content to nothing might allow the table cell to collapse. And I thought that 1 pixel transparent gifs were so 1992.

The second content tag reduces the space available for the ‘page title area’ through CSS. It overrides some of the styles to do this. Of course, this relies on your master page using those styles, or having that structure – so if you’re planning on creating a custom master page, you’d better think of all custom page layouts too. I’m not really convinced about that as design – it seems to me that this makes creating a new, radically different master page even harder, as the page layouts must be rebuilt too.

Advertisements
Page Layouts, Breadcrumbs, and the space above the main content area of a page.

2 thoughts on “Page Layouts, Breadcrumbs, and the space above the main content area of a page.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s