Previously I’d posted about SharePoint Breadcrumbs and how they were confusing as hell. I’d discussed how SharePoint publishing pages override the ‘PlaceHolderTitleBreadcrumb’ content control, filling it with blankness, and then supplying their own breadcrumb as part of the page content. That seemed pretty dumb to me… …much more sensible would be to override the ‘PlaceHolderTitleBreadcrumb’ with the breadcrumb we want.
Well, it transpires that I was wrong. What I’ve described is true for some page layouts… and not for others. The Default Master page defines its PlaceHolderTitleBreadcrumb ContentPlaceHolder control as:
<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server">
<asp:SiteMapPath SiteMapProvider="SPContentMapProvider" id="ContentMap" SkipLinkText="" NodeStyle-CssClass="ms-sitemapdirectional" runat="server"/>
</asp:ContentPlaceHolder>
This is defining the default breadcrumb on the master page.
For the DefaultLayout.aspx layout page, it defines the content for the page to have:
<asp:Content ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server"/>
That will empty the placeholder on the master page, so no breadcrumb will appear in the usual location - in fact, nothing will. (Note: you will probably want to reduce the blank space that the breadcrumb occupied - otherwise you’ll have a bit gap above your main content area). It then goes on to define (in the PlaceHolderMain Content control):
<td class="ms-pagebreadcrumb" colspan="2">
<asp:SiteMapPath ID="ContentMap" Runat="server" SiteMapProvider="CurrentNavSiteMapProviderNoEncode" RenderCurrentNodeAsLink="false" SkipLinkText="" NodeStyle-CssClass="ms-sitemapdirectional"/></td>
</tr>
There we can see the breadcrumb that appears in the page content.
However, if we look at a different page layout, such as BlankWebPartPage.aspx, we see:
<asp:Content ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server">
<div class="breadcrumb">
<asp:SiteMapPath ID="siteMapPath" Runat="server" SiteMapProvider="CurrentNavSiteMapProviderNoEncode" RenderCurrentNodeAsLink="false" SkipLinkText="" CurrentNodeStyle-CssClass="breadcrumbCurrent" NodeStyle-CssClass="ms-sitemapdirectional"/>
</div>
</asp:Content>
Okay, interesting. So, what’s different about the breadcrumbs? Well, a few things, but the point relevant to whether or not the “> Pages > default.aspx” is displayed in the breadcrumbs - the SiteMapProvider. The CurrentNavSiteMapProviderNoEncode provider doesn’t seem to include the ‘Pages’ bit of the path - hence it is used by the page layouts. The Default.master’s SPContentMapProvider provides a breadcrumb that includes the ‘Pages’.
It is a bit mystifying why some page layouts blank the PlaceHolderTitleBreadcrumb while other override it - it would have been really nice if they worked consistently. And, as a side note, if you create a page layout and find that your breadcrumbs include the “> Pages > default.aspx” bit, then 1) make sure you’re providing content to override the PlaceHolderTitleBreadcrumb, and 2) make sure that it uses the CurrentNavSiteMapProviderNoEncode navigation provider.
[...] 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 [...]
I have only one word for SharePoint:
WHY?!?!?!?!?
People around here aren’t going to like being told that if they want a custom master page, they need a full set of custom page layouts too. How annoying.
Unfortunately this is just one example of how “ad-hoc” and “dictating” SharePoint is regarding look & feel. It’s as if it’s not designed to have its master page changed. Hahaha!
Well, they don’t *have* to use page layouts and so on - they could just not use the Publishing Features. Or they could design a master page that fits with the out-of-box page layouts.
I just sort of wish that the out-of-box page layouts didn’t do this.
Modifying the page layouts isn’t hard, and I totally get that you’ll need new layout(s) for each new Page content type (as they’re displaying different stuff). It’s just confusing for users (and developers) when they first come across this.
[...] and I enabled statistics on the blog. It’s been a bit of an eye-opener. My posts on ‘What the heck is going on with SharePoint Breadcrumbs‘ and ‘More SharePoint Breadcrumbs WTF‘ have together more hits that any of my [...]
This has been frustrating me for awhile, but there is a workaround to it. Masterpages use the ContentPlaceholder ID to know where to put stuff. All you have to do is put the breadcrumb in your own ContentPlaceholder and put the code in that.
I’m not entirely sure I follow.
Yes, if you’re defining your own master page you can actually remove any breadcrumb entirely.
And if you’re defining a Page Layout you can define an ASP Content control to override the Placeholder’s default content. This is exactly what some of the pages above are doing. For example, above shows the DefaultLayout.aspx page removing the Title breadcrumb by setting the PlaceHolderTitleBreadcrumb to be empty content.
My frustration with it is that out of the box some pages override the standard breadcrumb and supply their own, while others do not. Until you get stuck into the code, this isn’t particularly obvious, and it has confused some of our clients. I don’t mind the different Navigation Providers and that one of them shows the Pages library; I understand the reasons for that, and it’s easy to explain to customers. But the funny going’s on with where the breadcrumb is shown just seems to leave customers asking ‘Why?’
Your situation is a bit different than mine. We moved our SPS 2003 to MOSS 2007. We made all our areas into sites and used the blank web part page as the page template but used a custom publishing page master using the out of the box page layouts. The blank web part page overrides the PlaceHolderTitleBreadcrumb ContentPlaceHolder so it doesn’t show. To get it to show I did something to the tune of:
<asp:SiteMapPath etc…
This forced the breadcrumb to show because the ForcePlaceHolderTitleBreadcrumb isn’t overridden in the page layout.
It looks like your comments don’t allow any html…if you want to email me I’ll reply with a code example of what I’m talking about.
Yeah, I’m afraid they don’t; I was suffering comment spamming problems. I’ll email you.
BTW, the above code examples do allow HTML - the Master page, ASP:ContentPlaceholders in it, and the ASP:Content tags in the page layout all allow HTML. I just stripped some of it out to focus on the ASP code.
[...] I’ve written about this before, but really it was just an addendum to another point I was trying to make. It might be worth bringing out as a post in itself. [...]
How can handle a situation of this caliber for wss 3.0 I modified the master page to conform to specification offered to me by a design and for some reason the breadcrum does not show any more. I am using sharePoint designer 2007 an do not have access to sharePoint box it self but I can modify the master page.
I am trying to limit the depth of the breadcrumbs. I have a sub sub sub subsite that I want breadcrumbs to show from that site and down one more level. I can make the breadcrumbs invisible using SPD but I wonder if I can make them limited … like we could in WSS 2. Does it have to do with permissions?
Thanks…. I am not a programmer but I do alot of customization within SPD.
Jo
Such a good question Jo, I thought I’d post about it:
http://www.novolocus.com/2008/06/11/limiting-the-levels-shown-in-sharepoint-breadcrumbs/
[...] was such a good question, I thought I’d reply in a post about it: I am trying to limit the depth of the breadcrumbs. I [...]
I found these articles helpful to get started with my breadcrumb problem as I am newbie to SharePoint. I have inherited a SharePoint pilot where master page and site templates have been customized. I was migrating sites from another CMS through the SharePoint API’s. At first my new sites had no breadcrumbs, but then I saw that they were not inheriting in Global Navigation settings. However, the breadcrumbs do not follow into the navigation of a document library. Any commentary appreciated.
Actually, I solved my problem above. You have to click the link to follow the Shared Document Web Part to its proper page to see the full breadcrumb.
Thanks so much for this insight. These breadcrumb inconsistancies have been confusing the heck out of me until now. Great Post