Sunday, June 3, 2012

Hide Site Collection’s root link in breadcrumb top navigation

Although you can set up a Site Collection so the members of the internal Sites are not able to access the root of the Site Collection, they are still able to have this hateful “You don’t have permissions to this page” SharePoint error. Why grant the access to this page when you can just hide this link in the breadcrumb top navigation?

The goal of this entry is to hide the root navigation item (the root of the Site Collection), so the user is not able to click there, modifying the Site Collection’s master page in SharePoint Designer. I must admit that I don’t like this tool, and my recommendation would be create a new master page, deploy it, and then in the feature receiver set our custom master page as the default one. Anyway, as for the time being, I will use the SPDesigner’s approach.

Here are the steps:

  • Open and modify the current master page using SharePoint Designer or editing it and then uploading to the master page gallery.
  • Locate the control SharePoint:ListSiteMapPath.
  • Add the property ParentLevelsDisplayed as follows ParentLevelsDisplayed="0”

The final control should look like:


runat="server"
SiteMapProviders="SPSiteMapProvider,SPContentMapProvider"
RenderCurrentNodeAsLink="false"
PathSeparator=""
CssClass="s4-breadcrumb"
NodeStyle-CssClass="s4-breadcrumbNode"
CurrentNodeStyle-CssClass="s4-breadcrumbCurrentNode"
RootNodeStyle-CssClass="s4-breadcrumbRootNode"
NodeImageOffsetX=0
NodeImageOffsetY=353
NodeImageWidth=16
NodeImageHeight=16
NodeImageUrl="/_layouts/images/spoverrides/fgimg.png"
HideInteriorRootNodes="true"
SkipLinkText=""
ParentLevelsDisplayed="0"/>

No comments:

Post a Comment