{"id":706,"date":"2012-07-13T16:59:28","date_gmt":"2012-07-13T21:59:28","guid":{"rendered":"http:\/\/osric.com\/chris\/accidental-developer\/?p=706"},"modified":"2012-07-13T16:59:28","modified_gmt":"2012-07-13T21:59:28","slug":"sharepoint-breadcrumb-styles","status":"publish","type":"post","link":"https:\/\/osric.com\/chris\/accidental-developer\/2012\/07\/sharepoint-breadcrumb-styles\/","title":{"rendered":"SharePoint Breadcrumb Styles"},"content":{"rendered":"<p>SharePoint (and .NET) has a built-in <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/x20z8c51.aspx\">SiteMapPath<\/a> control that is designed to display a breadcrumb trail.<\/p>\n<p>There are a lot of options in terms of styling the breadcrumb trail, but it is not obvious how all of them are used. Even more confusing, though, is when you make a change the the styles but you don&#8217;t see that change reflected on your site. For example, on one site I am working on I saw breadcrumbs like these:<\/p>\n<figure id=\"attachment_716\" aria-describedby=\"caption-attachment-716\" style=\"width: 161px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/osric.com\/chris\/accidental-developer\/wp-content\/uploads\/2012\/07\/sharepoint-breadcrumbs.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/osric.com\/chris\/accidental-developer\/wp-content\/uploads\/2012\/07\/sharepoint-breadcrumbs.png\" alt=\"An example of SharePoint breadcrumbs\" title=\"sharepoint-breadcrumbs\" width=\"161\" height=\"80\" class=\"size-full wp-image-716\" \/><\/a><figcaption id=\"caption-attachment-716\" class=\"wp-caption-text\">An example of SharePoint breadcrumbs<\/figcaption><\/figure>\n<p>I didn&#8217;t like how much vertical space this style occupied. I wanted something a little more compact. But how to change the appearance?<br \/>\n<!--more--><br \/>\nIt turns out, that element above is actually an example of the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.sharepoint.webcontrols.listsitemappath.aspx\">ListSiteMapPath<\/a>, a SharePoint control which inherits from the .NET SiteMapPath.<\/p>\n<p>How did I not realize that? When I looked at the code, it certainly looked like a SiteMapPath control:<\/p>\n<pre><code>&lt;asp:ContentPlaceHolder ID=\"PlaceHolderTitleBreadcrumb\" runat=\"server\" Visible=true&gt;\r\n    &lt;asp:SiteMapPath \r\n        SiteMapProvider=\"CurrentNavigation\" \r\n        ID=\"ContentMap\" \r\n        SkipLinkText=\"\"\r\n        CurrentNodeStyle-CssClass=\"breadcrumbCurrent\" \r\n        NodeStyle-CssClass=\"ms-sitemapdirectional\"\r\n        runat=\"server\" \/&gt;\r\n&lt;\/asp:ContentPlaceHolder&gt;<\/code><\/pre>\n<p>The key thing to note here is that the <strong>SiteMapPath<\/strong> is wrapped in a <strong>ContentPlaceHolder<\/strong>. Anything inside the ContentPlaceHolder is the default for the masterpage, but can be optionally overridden by the Page Layout. In this case, I was using one of the default Publishing page layouts found in<br \/>\n<code>C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\TEMPLATE\\FEATURES\\PublishingLayouts\\PageLayouts<\/code><\/p>\n<p>That file contained a ContentPlaceHolder for PlaceHolderTitleBreadcrumb that was overriding the masterpage:<\/p>\n<pre><code>&lt;asp:Content ContentPlaceHolderId=\"PlaceHolderTitleBreadcrumb\" runat=\"server\"&gt;\r\n    &lt;SharePointWebControls:VersionedPlaceHolder UIVersion=\"3\" runat=\"server\"&gt;\r\n        &lt;ContentTemplate&gt;\r\n            &lt;asp:SiteMapPath \r\n                ID=\"siteMapPath\" \r\n                runat=\"server\" \r\n                SiteMapProvider=\"CurrentNavigation\" \r\n                RenderCurrentNodeAsLink=\"false\" \r\n                SkipLinkText=\"\" \r\n                CurrentNodeStyle-CssClass=\"current\" \r\n                NodeStyle-CssClass=\"ms-sitemapdirectional\"\/&gt;\r\n        &lt;\/ContentTemplate&gt;\r\n    &lt;\/SharePointWebControls:VersionedPlaceHolder&gt;\r\n    &lt;SharePointWebControls:UIVersionedContent UIVersion=\"4\" runat=\"server\"&gt;\r\n        &lt;ContentTemplate&gt;\r\n            &lt;SharePointWebControls:ListSiteMapPath \r\n                runat=\"server\" \r\n                SiteMapProviders=\"CurrentNavigation\" \r\n                RenderCurrentNodeAsLink=\"false\" \r\n                PathSeparator=\"\" \r\n                CssClass=\"s4-breadcrumb\" \r\n                NodeStyle-CssClass=\"s4-breadcrumbNode\" \r\n                CurrentNodeStyle-CssClass=\"s4-breadcrumbCurrentNode\" \r\n                RootNodeStyle-CssClass=\"s4-breadcrumbRootNode\" \r\n                NodeImageOffsetX=0 \r\n                NodeImageOffsetY=353 \r\n                NodeImageWidth=16 \r\n                NodeImageHeight=16 \r\n                NodeImageUrl=\"\/_layouts\/images\/fgimg.png\" \r\n                HideInteriorRootNodes=\"true\" \r\n                SkipLinkText=\"\" \/&gt;\r\n        &lt;\/ContentTemplate&gt;\r\n    &lt;\/SharePointWebControls:UIVersionedContent&gt;\r\n&lt;\/asp:Content&gt;<\/code><\/pre>\n<p>Once I switched to a custom layout that did not include a ContentPlaceHoler for PlaceHolderTitleBreadcrumb, the defaults from the masterpage came through.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SharePoint (and .NET) has a built-in SiteMapPath control that is designed to display a breadcrumb trail. There are a lot of options in terms of styling the breadcrumb trail, but it is not obvious how all of them are used. Even more confusing, though, is when you make a change the the styles but you &hellip; <a href=\"https:\/\/osric.com\/chris\/accidental-developer\/2012\/07\/sharepoint-breadcrumb-styles\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">SharePoint Breadcrumb Styles<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[180],"tags":[257,256,258,160,246],"class_list":["post-706","post","type-post","status-publish","format-standard","hentry","category-sharepoint-2","tag-breadcrumb-trail","tag-breadcrumbs","tag-contentplaceholder","tag-sharepoint","tag-sharepoint2010"],"_links":{"self":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/706","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/comments?post=706"}],"version-history":[{"count":13,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/706\/revisions"}],"predecessor-version":[{"id":726,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/706\/revisions\/726"}],"wp:attachment":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/media?parent=706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/categories?post=706"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/tags?post=706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}