Monday, August 25, 2008

Hide Document library name like "Pages" link from BreadCrumb

Always people like breadcrumb but always hate sharepoint breadcrumb just because of it shows document library name in breadcrumb when you are on the page which exists in that document library. Like:- There is one Test.apsx page in my Pages Document Library.
Sharepoint will show it like :- Site -> Pages ->Test.aspx . Everybody hate that thing because when use click on Pages link it will show user that document library and all items in it. Which no body want to show.
When i was caught doing this then i realize that how big this issue is specialy for client. Then i thought to resolve this issue.

So finally here is the script which can save your like (can hide Document Library like "Pages" link from breadcrumb):-




[script language="javascript" type="text/javascript"]
var breadCrumbs = document.getElementById('ctl00_PlaceHolderTitleBreadcrumb_ContentMap')
if (breadCrumbs != null)
{
if (breadCrumbs.childNodes.length >= 3)
{
if (breadCrumbs.childNodes[2].innerHTML.indexOf('Pages') > 0)
{
breadCrumbs.childNodes[1].innerHTML = "";
breadCrumbs.childNodes[2].innerHTML = "";
}
}
}[/script]
//Change '"[","]" to "<",">" in script tag.
Just put this code either in Master page or on the same page where you want to hide document library name from breadcrumb.

Enjoy breadcrumb rather hate it more.
Kuldeep Kadyan.

No comments: