Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have been using this for breadcrumbs:

<div id="breadcrumbs"> <span name="onetidProjectPropertyTitle">
  <asp:ContentPlaceHolder id="PlaceHolderSiteName" runat="server">
    <SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="onetidProjectPropertyTitle">
      <SharePoint:projectproperty Property="Title" runat="server" />
    </SharePoint:SPLinkButton>
  </asp:ContentPlaceHolder>
  </span> <span id="onetidPageTitleSeparator" class="s4-nothome s4-bcsep s4-titlesep">
  <SharePoint:ClusteredDirectionalSeparatorArrow runat="server"/>
  </span>
  <asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" />
  <div class="s4-pagedescription" tabindex="0" >
    <asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat="server"> </asp:ContentPlaceHolder>
  </div>
</div>
<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server"> </asp:ContentPlaceHolder>
</div>

Is there a better way to do this?

Thanks.

share|improve this question

4 Answers 4

up vote 2 down vote accepted

There is no direct answer to this as it depends on your final usage. The one you mention seems like the v4.master one -actually there are 2 even there (the PopUp and Horizontal), serving diferent purposes - In-Site navigation (where in hte context of the current spweb you are) and Out-of-Site navigation (small popUp via Folder icon, showing where in the context of your Site Collection - SPSite you are).

Semantically they are the same, but the diference comes from the DataSource (or Provider), or course then you could style it your way, which could make a hell of a difference (e.g. in Publishing Site you need to adapte to something else, or instead of seing a page you would see the name of the file with Pages folder between - such as explained here http://blog.sharepointrx.com/2010/01/10/fixing-sharepoint-breadcrumbs-to-remove-the-pages-node-and-display-the-page-title-instead-of-the-aspx-page-name/)

Good description on Headther Solomon's blog http://www.heathersolomon.com/blog/archive/2008/08/13/SharePoint-Breadcrumbs--Sample-of-differences-chart-of-uses-and.aspx

For more ideas I would point you to these links

Hope it helps, C:\Marius

share|improve this answer
    
Thanks @C.Marius –  jasonflaherty Apr 30 '12 at 20:54

Better way? No, not really. You have alternative ways of setting up a breadcrumb, but that is in my opinion the best and most accurate breadcrumb, as it displays the exact details for your current location on the website. Other alternatives, like the one Stefano Paterno, works, but they don't give you that same exact location as you might want when you're navigating in lists on subsites, or in the backend.

The closest I've gotten to a similar breadcrumb setup, was by using these 3 SiteMapProviders:

  1. SPXmlContentMapProvider
  2. SPContentMapProvider
  3. CurrentNavSiteMapProvider

share|improve this answer

I'm using this code:

<div id="breadcrumbs">
            <asp:SiteMapPath ID="siteMapPath" Runat="server" SiteMapProvider="CurrentNavSiteMapProviderNoEncode" RenderCurrentNodeAsLink="false" PathSeparator=" | "/>
        </div>
share|improve this answer
    
I get some kind of Correlation Error... any thoughts on that? I see another <asp:SiteMapPath ID="siteMapPath1".... in my MasterTemplate. I am not sure how to debug these errors. –  jasonflaherty Feb 23 '12 at 18:58

Here is mine, which I use in the Master Page of my publishing site. It is pretty close to what I want. There are a few tricks you can do by putting two breadcrumbs one behind the other and then using the class properties to hide certain parts.

This seems like the easiest and most comprehensive way I have found. It does not use any behind-the-scenes code or solutions. Just drop this in your master page.

<div class="bestbreadcrumb">
    <asp:SiteMapPath ID="bestpath" Runat="server" 
        SiteMapProvider="GlobalNavSiteMapProvider" 
        CssClass="ms-sitemapdirectional"
        NodeStyle-CssClass="ms-sitemapdirectional" 
        RenderCurrentNodeAsLink="true" 
    />: 
    <asp:SiteMapPath ID="bestsubpath" Runat="server" 
        SiteMapProvider="SPContentMapProvider" 
        CssClass="ms-sitemapdirectional"    
        NodeStyle-CssClass="ms-sitemapdirectional" 
        RenderCurrentNodeAsLink="false" 
        CurrentNodeStyle-CssClass="breadcrumbCurrent" 
        ParentLevelsDisplayed="0"
    />
</div>

This method renders the path of the subsites and only shows the pages library if you are at the root of the libary. When pages are displayed in the breadcrumb, the library is not shown in the breadcrumb.

Examples:

  • Home: Home (Root)
  • Home: Shared Documents
  • Home: Site Pages Library
  • Home: page in Page Library
  • Home > Site1: page in Page Library
  • Home > Site1: page in Page Library
  • Home > Site1: Calendar
  • Home > Site2 > Subsite: Subsite
  • Home > Site2 > Subsite: Library
  • Home > Site3 > Subsite > Subsite: Home
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.