SharePoint Experts, Information Architects, Expert Witness

We provide consulting in a broad array of business and technology from architecture to design to deployment of global systems with a focus on surfacing data in the enterprise. Specialists in Microsoft, we are a premier provider of SharePoint Expertise (including 2016 and Office 365). We also provide Expert Witness/Legal Expert in eDiscovery, source discovery, patent infringement, piracy and more! We also have established SICG DLDS s.a. - our counterpart in Costa Rica that specializes in water systems (http://www.crwatersolutions.com) - Contact me direct: david_sterling@sterling-consulting.com or call 704-873-8846 x704.

Search This Blog

Sunday, July 28, 2013

SharePoint 2010 V4 Master Breaks Search Site

SharePoint 2010 V4 Master Breaks Search Site
Hey – I know it’s dated (with 2013 out and all) but I've had to help so many fix this nagging problem with 2010 master pages that I am formally posting it.

If you have ever tried to use the Search Center site, you should have noticed that this particular site always uses the ‘minimal.master’:



For many, that’s fine but most folks want to customize their master or at least use the v4.master on all sites so it is consistent. Using the v4.master (or a customized copy of it) then pushing it down to all sites it will in fact ‘break’ the search page:



As you can see, the search box is missing and there is an odd box on the left. In reality, the search box is still there, just in the wrong place – it appears under the ‘Navigate Up’ icon:
(Now that’s QA for ya)

Fixing this is fortunately not a very big deal (just takes some time) – the process is to simply create an additional master page specifically for the search site. The original v4.master (or master derived from it) should be left alone – the changes here are ONLY for the Search Site!

Step 1)
  1.  Download the v4.master (or master you are using based on v4)
  2.  Name the file <name>_search.master (i.e. v4_search.master)
  3.  Make a copy of it so you can restore/start over if you have to

Step 2)

1. Open the file in Notepad, Notepad++ or Visual Studio (do NOT use SharePoint Designer!)
2. Search the code to find this line:

       <SharePoint:SPHelpPageComponent Visible="false" runat="server"/>

3.    Add this below it:


       <style type="text/css">
              #s4-leftpanel {
                     display: none !important;
              }
             
              #MSO_ContentTable {
                     margin-left: 0 !important;
              }
       </style>

4.       Next, find this:

<div class="s4-breadcrumb-top">
       <asp:Label runat="server" CssClass="s4-breadcrumb-header" Text="<%$Resources:wss,master_breadcrumbHeader%>" />
</div>
 <asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server">
       <SharePoint:ListSiteMapPath
              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/fgimg.png"
              RTLNodeImageOffsetX=0
              RTLNodeImageOffsetY=376
              RTLNodeImageWidth=16
              RTLNodeImageHeight=16
              RTLNodeImageUrl="/_layouts/images/fgimg.png"
              HideInteriorRootNodes="true"
              SkipLinkText="" />
       </asp:ContentPlaceHolder>
</SharePoint:PopoutMenu>

5.       Copy then delete these two lines:

<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server">
...
</asp:ContentPlaceHolder>

After the edit, the code should look like this:
<div class="s4-breadcrumb-top">
       <asp:Label runat="server" CssClass="s4-breadcrumb-header" Text="<%$Resources:wss,master_breadcrumbHeader%>" />
</div>
       <SharePoint:ListSiteMapPath
              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/fgimg.png"
              RTLNodeImageOffsetX=0
              RTLNodeImageOffsetY=376
              RTLNodeImageWidth=16
              RTLNodeImageHeight=16
              RTLNodeImageUrl="/_layouts/images/fgimg.png"
              HideInteriorRootNodes="true"
              SkipLinkText="" />
</SharePoint:PopoutMenu>

6.       Next, find this:

       <a name="mainContent"></a>
       <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server">
       </asp:ContentPlaceHolder>
       </div>

7.       Paste in these two lines after the <a name="mainContent"></a> line:

<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server">
</asp:ContentPlaceHolder>

After the edit, it should look like this:
<a name="mainContent"></a>
       <asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server">
       </asp:ContentPlaceHolder>
       <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server">
       </asp:ContentPlaceHolder>
       </div>

8.       Save the file then upload to your Master Page Gallery library (or deploy it via  a feature – whatever works; for testing, uploading is fine) – be sure it is published and approved!

9.       Navigate to the Search site and change the master page to the new master – if all was edited properly, the home page should appear correct: