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"/>
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>
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">
<asp:SiteMapPath ID="siteMapPath" Runat="server" SiteMapProvider="CurrentNavSiteMapProviderNoEncode" RenderCurrentNodeAsLink="false" SkipLinkText="" CurrentNodeStyle-CssClass="breadcrumbCurrent" NodeStyle-CssClass="ms-sitemapdirectional"/>
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.
35 thoughts on “More SharePoint Breadcrumb WTF”
[…] 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:
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:
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.
Such a good question Jo, I thought I’d post about it:
[…] 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
Great Post, i also got the same problem,
my publishing sites are showing …>Page>Default.aspx
I followed above discussions, but still its showing same
1) Created one master page using BlueGlassBand.master and having below code for breadcrumb
2) Created one layout for publishing sites, as suggested i placed the below code
Please any one help me, where i’m going wrong
And what if I want NO breadcrumb at all? At least no “site part” (the “pages part” would be OK)
Hmm. Then you’re probably looking at creating a new Navigation Provider – you can write your own in C# and add them to your SharePoint system. In fact, I did this about 3 weeks ago (very specialist app, though).
I would be a bit worried about not having the ‘site’ part – unless you break from the parent site’s navigation each time (so an entry is added to the global navigation menu), you won’t have a way to get back to a parent site…
I’ve seen the bread-crumbs and the confusing nature of site navigation through sharepoint. The out-of-the-box set up would suffice for now (including the bread-crumbs) because the scope of this project isn’t focusing on navigation for the Master Site. However, bread-crumbs would be a terrific feature for the “Shared Document Web Part”. Yet if have not figured out how to–or even if it supports–adding bread-crumbs.
Any ideas on doing this. I would think that if you can add folders to a document library you would have better system of navigation of going back up through directory levels than going back to root and clicking back down to where you want to go.
Or instead… should I go with a site structure and place their own individual document libraries?
Well… by the “Shared Document Web Part” you probably mean a ListView web part that displays items in a Document Library called ‘Shared Documents’.
ListView web parts are just ‘views’ on to the information held in a document library, so it’s the breadcrumbs in that library that are important. Having breadcrumbs in the web part itself might be a little confusing as you’d then have a) the breadcrumbs for the page you’re looking at an b) the breadcrumbs for the context of the document library.
AFAIK, there is no easy way to show breadcrumbs within a ListView web part.
Good post Andy.
I’m branding our institution’s SharePoint (working from Heather Solomon’s minimal master as a startpoint) and I have publishing sites generating unwanted breadcrumbs.
The default code, using “SPContentMapProvider”, renders an unwanted “Pages > default.aspx” where my page level breadcrumbs normally show, plus a duplicate global breadcrumb trail inside the “PlaceHolderMain” area:
It does however render a page level breadcrumb trail at list/folder level:
Modifying the code to use “CurrentNavSiteMapProviderNoEncode” instead, renders a duplicate global breadcrumb trail where my page level breadcrumbs normally show, plus a duplicate global breadcrumb trail inside the “PlaceHolderMain” area:
And the page level breadcrumb trail at list/folder level is replaced by a global breadcrumb trail:
Argh. This is driving me NUTS.
How in the name of X do I create a publishing site master which doesn’t show “Pages > default.aspx” at the home page level, but DOES show page-level breadcrumbs at the list/folder level?
I have a question.
Who do everybody help me customize “SPContentMapProvider” ?
The expect result:
Hi David, baoden0920,
You’ve both got the same problem, and I addressed it better in this link:
Hope that helps!
I am not an expert quite yet with SP and SPD and I just need to know how to add a breadcrumb to a single document library page. Can anyone advise?
I am trying to show a space betweeen words in breadcrumb URL, for example:
Home > Create New User > Pages
here if i create site with spaces, URL autometically changes space with %20 and the same is reflected in Breadcrumb, as : Home > Create%20New%20User > Pages.
Here I described how to derive a class from SiteMapPath (breadcrumb) and add nodes or change ones.
Would like to hide the breadcrumb for all the users apart of site owners(administrators).
How can I implement this in sharepoint?
I would suggest using a custom master page, and add an SPSecurityTrimmedControl control around the breadcrumb control. Set the SPSecurityTrimmedControl to whatever right level you want to require. Note that if you’re using the publishing features, you may have to modify some of your page layouts as well – some of them override the ‘standard’ breadcrumb. (See my other breadcrumb posts for details).
I dont know if you still look at the comments on this page but I have something that has been bugging me for a while.
I am about to embark on a trek, that is, setting up a SP installation for a small company with fairly minimal customization.
However, breadcrumbs with SP bother me, I feel like from many other CMS’s I have tried, you can related parent and child pages, and have a simple hierarchy of information. This doesn’t seem possible to me without making subsites for each of the “parent” categories of information.
Am I being clear with what I expect? I would want to see something like the following in my breadcrumb trail. Main page> parent page which is also a category > second page hosted within the same site, but fitting within this parent category. I seem to be unable to figure this one out!
Yup, that’s about right. Without customisation it’s easy to end up needing sites, and subsites, and subsubsites, and so on.
You can achieve a better experience by customisation the navigation – particularly if you’re willing to add custom Navigation Providers – but yes, with the standard functionality, the navigation side of Publishing Pages isn’t excellent – precisely because it does cause a proliferation of sites.
Hey Andy, hope you are still checking comments in this post.
I have a weird problem with breadcrumb on sharepoint 2007
I have main website (Company) then a subsite (Services), using “Modify Navigation” the pages on the Subsite are organised under Headings, for example ‘ServiceA’ heading has the pages ‘Pricing’ & ‘Specifications’ under it, both pages uses the same Page layout which has SiteMapPath that uses CurrentNavSiteMapProviderNoEncode provider.
The issue is the breadcrumb is displayed different in the two pages as follow
Company -> Services -> ServiceA -> Pricing
Company -> Services -> Specifications
For some reason in the second page the breadcrumb didn’t display the heading ‘ServiceA’
Any suggestions what could cause such issue?
Note: This website is built long time ago, and I’m just trying to fix this bug now.
Hmm. Nope, off the top of my head, I don’t know what that would be. If it’s the same page layout, and same provider, and the pages are siblings, I don’t see why they would be different. Is one the site’s home page or something?
Thanks for your reply Andy!
All are just pages in the subsite, so none of them is the home page.
Actually this website created so long time ago, and has been copied across different environments (many testing ones & the prod one), and when I try to create any new page now using same page layout and put it in the navigation tree, it always ignores the heading in the breadcrumb.
Could it be that something messed up because of copying the website, also is there any kind of configuration or settings that makes the breadcrumb ignores the heading in the subsite?