Like many web applications, SharePoint uses ‘Breadcrumbs’ for navigation. This is a set of links that both tell you where in a hierarchy you are, and were you can go to. SharePoint, though, uses two:
You can see them here at the top left, and then above the word ‘Documents’. But wait, the master page shows us two breadcrumbs? You’re only in one hierarchy, so how does that work? The Planning & Architecture documentation on Technet says:
The default.master master page, which displays form and view pages, includes two breadcrumb controls, a global breadcrumb which contains sites only, and a content breadcrumb, which contains sites and the current page. Some collaboration site templates, such as the Team Site template, also include two breadcrumbs on all Web pages
However, this isn’t quite the complete story.
I found myself looking at navigation similar to this:
So, I’m in a document library, in a subsite called ‘Parent Nav’. The ‘global’ breadcrumbs still just shows the top site though, and the ‘content’ breadcrumbs has 2 sites in its links. This left me more than a little confused – what the heck made a site appear on the top breadcrumbs or the bottom one?
Well, the names in my site give you a clue as to what is different about where the site ends up being shown – whether it inherits the parent site’s navigation, or whether is has its own. This is set during site creation:
Or from the Site Settings page. What you see then, though, depends on whether you’re using the publishing features or not:
If you select that you don’t want to use the parent’s links, then it’s like you’re breaking out of the ‘navigational context’ of the parent. The ‘Content Breadcrumbs’ (or ‘Title Breadcrumbs’) (the things that go in the PlaceHolderTitleBreadcrumb placeholder in the master page) only start from this context, so they are shorter. However, the ‘Global Breadcrumbs’ now show both the parent ‘context’ and the current site. This is shown below, where both sites are at the same level. The bottom image does not inherit the parent’s navigation:
Now, the observant will have noticed that I talk about ‘contexts’ rather than sites. That’s because I tried a hierarchy of sites 4 deep – lets call it A > B > C > D. I made B and D use their own navigation (i.e. not inherit their parent’s). This meant that C would inherit from B. If we view the bottom site, D, what would be shown in the navigation? Would the global breadcrumb contain “A > B > C > D“, or “A > B > D“?
Well, it turned out to be the latter. It appears that the SPSiteMapProvider (which supplies the entries for the global breadcrumbs) provides a trail of the sites up the hierarchy which use their own navigation. The SPContentMapProvider (which supplies the ‘Title Breadcrumbs’), provides a trail of the sites up the hierarchy which do inherit from the parent.
Thus, confusingly you can end up with sites in each of the two breadcrumbs. However, this does hav the advantage that, with deep hierarchies, you can kind of ‘hide’ some of the intermediate layers, as we did with “C” in our test above.
An Added Complexity – Page’s own Breadcrumbs
So, we’ve talked about the 2 breadcrumbs typically found on the master page. There is another one, of course, just to make life confusing. This is actually found in some of the content pages themselves, rather than in the master page. In the screenshot below, everything below and right of the red line is page content, not part of the master page.
Okay, so what’s going on there? Well, first off, the page is defining empty content for the ‘PlaceHolderTitleBreadcrumb‘. In Master pages there are content placeholders, and these can have default content. Pages themselves can defined content for that placeholder, and this overrides the content that was there. That’s what is happening here, and this is making our default content – the breadcrumb – disappear from our page. Then, it is defining it’s own breadcrumb within it’s own content. Lots of pages do this – the home page of your collaboration site does. But why does it need it’s own breadcrumb?
Well, to find out, I hacked one of the pages so it always displayed the Title Breadcrumb. The first thing I noticed on going to the home page of my root site was that the breadcrumb read “Site > Pages > Default.aspx“. Technically that is correct, that is the page being shown, but it doesn’t really match up with the URL for the page and I could see that it would confuse users. Every time they clicked for the home page they are given a page which appears to be two ‘levels down’.
What I don’t understand, though, is why the page doesn’t just override the normal ‘Title Breadcrumb’ with its own. I mean, it could. Instead, though, we have the Title Breadcrumb being overridden with ‘nothing’ so it doesn’t display, and then another navigation control! I don’t know what that’s about…