Limiting the levels shown in SharePoint Breadcrumbs

This 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 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. – Jo Arnspiger

Well, there are a couple of ways that spring to mind (there are many approaches, but these are probably the best two) – one that uses SharePoint Designer, and one that uses SharePoint’s own navigation configuration.

First off, let’s look at the SharePoint Designer route. If you go to your master page or page layout, you’ll see an ASP control called the SiteMapPath control. It has a property called ParentLevelsDisplayed.

A SiteMapPath control showing the ParentLevelsDisplayed property.

Set that to a number, and that should be the maximum number of levels shown. If you set it to -1, it will show however many levels there are, which is it’s default. (I’ve not tried it, but I’m pretty sure that’s the case). That’s probably what you want, but there is a problem – it’s not just your master page which defines the SiteMapPath control. There is one on most of the Publishing Page layouts that come out of the box too. Still, if you’re happy taking a little time to change all of them, then that’s probably fine.

The other problem is a little more fundamental – this setting will apply across your entire site collection. Well, okay, maybe not, but it’ll apply for all pages using that master page or page layouts…

Alternatively, you could change the Site’s navigation settings to get what you want. At the ‘sub sub sub subsite‘ you could change the site’s navigation setting to not inherit it’s top navigation settings from the parent site. This will add a level to the ‘Global Navigation’ breadcrumb, but also make all URLs below the ‘sub sub sub subsite‘ start at that level. See my previous article for an explanation.

The down side about this approach, though, is that it means all of your top navigation tabs will change – you really are breaking with the ‘navigation context’ of the parent site. (That’s my term – I didn’t know what else to call it.) There is an example of this on the article linked to above.

A final note, these approaches do have two slightly different results – the first route is a ‘only show the last X items’, while the second is ‘chop all breadcrumbs below this site to start here’.

Anyway Jo, I hope that one of those is suitable.

Limiting the levels shown in SharePoint Breadcrumbs

4 thoughts on “Limiting the levels shown in SharePoint Breadcrumbs

  1. Baris says:

    Hi Andy,

    great post. But I want to make this one harder for you 🙂

    Our global company has a lot of subsites (sometimes 15 levels deep) which causes te breadcrumb to break to the next line. Or even if it doesn’t, it still is too long to be useful. What would be nice is if we can make it possible to use this kind of breadcrumb:

    Home > Site > Subsite … Almost there > Another Site > Current Site

    So the first three levels of sites, then some dots and then the last three levels. Do you think that this is doable?

  2. Hi Baris,

    Is it possible – yes. Is it possible out of the box – no. You’re looking at having to write a custom breadcrumb control there, if you insist on that ‘…’ link.

    However, SharePoint has similar functionality out of box – at some points in your heirarchy, stop inheriting the parent sites navigation (Go to Site Settings > Navigation to change this)

    See this post for details:

  3. You could do this with a combination of JavaScript and the jQuery library without too much trouble…

    I’d have to see the html of the breadcrumb trail in order to get a good idea of how to write the code though…

  4. Anu says:

    I have a requirement to make a subsites link in breadcrumb as normal text rather than a hyperlink. Is this possible? if so please help me in this case.

    i have modified the welcome page from default to my custom page (AboutUs.aspx)
    so my breadcrumb is showing my site title as well as the page.
    so i want my sites link in breadcrumb to be displayed as a normal text rather than a hyperlink.

    Please help me.

    Thanks in advance.


Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.