Posted on:
Categories: SharePoint
Description:

In SharePoint 2010 and 2013 sites, specifically intranets, I find myself often having subsites with only 1 page: the welcome page. And by default, each of these pages all have the page title Home. Many users report finding that confusing, as even though that page is the home page of the current web, it is not the home page of the entire site, which is typically what the users would expect home to mean. See below for an example of this:

Landing page Home link in breadcrumb

Note, we are in a subsite, but the breadcrumb still reads Home. A typical alternative to naming the home pages of each web the name of the web, but then you end up with what looks like a duplicate in the breadcrumb:

Landing page Modified Home link in breadcrumb

Solution!

It occurred to me that the SharePoint server-side object model exposes a property in the SPContext:

SPContext.Current.ContextPageInfo.IsWebWelcomePage

So I created a Control Template which I could then include into my master page to inject styles to hide the page title in the breadcrumb only if the user is currently viewing the welcome page (ie. the "Home" page. To do this, simply create a new Control Template in your Visual Studio project, and include the following code in the Page_Load method:

if (SPContext.Current == null || 
 SPContext.Current.ContextPageInfo == null ||
 !SPContext.Current.ContextPageInfo.IsWebWelcomePage) return;

StylesLiteral.Text = "<style type=\"text/css\">" +
 " .s4-title .s4-titletext > h2, 
 .s4-title .s4-titletext > span.s4-titlesep " +
 " { display: none; } " +
 "</style>";

And then in my custom master page, I simply had the following registration at the top...

 <%@ Register TagPrefix="Softlanding" 
 TagName="BreadcrumbOverrideControl" 
 src="~/_controltemplates/YourCustomSolutionName/BreadcrumbOverrideControl.ascx" %>

...and then the following within the <head> tag...

 <Softlanding:BreadcrumbOverrideControl runat="server" id="SLBreadcrumbOverride" />

No more Home!

And now in landing pages (aka welcome pages), we will no longer see the page title or the little arrow next to the page title:

Page Title no longer visible