There are three site templates to choose from when creating search sites in SharePoint 2010: Enterprise Search Center, Basic Search Center, and FAST Search Center. Unlike most other sites in SharePoint 2010, these sites do not have v4.master or even nightanddayIn fact, if you apply v4.master to one of the Search Centers, the search box seems to be removed from the page… when actually it is still on the page, just hiding up in the pop-out breadcrumb menu:
.master applied to them; instead, they have minimal.master applied to them. If you have a custom master page that is based on v4.master, nightandday.master, or even one of the typical starter master pages and apply it to one of these search center sites, you notice that the search center doesn’t work properly. This is because the page layouts and pages that are created by default for these search center sites are hard coded specifically to work best with the way minimal.master is coded.
As you can tell, this is less than ideal. Also problematic is the fact that the default minimal.master that is applied to the search centers doesn’t really contain traditional navigation or ways of navigating back to the parent site. So how do you get custom branding to work with the search center in SharePoint 2010? You have some options:
- Create a new custom master page based on minimal.master
- Adjust the page layouts or pages in the search center, to use the standard content placeholders (UPDATE: Here is a nice sandbox solution to help do this for you. In many cases this might be the best course of action if you are comfortable using 3rd party solutions: http://sp2010searchadapters.codeplex.com/ )
- Create a new custom master page with some minor adjustments for the way search centers work
- Make a copy of v4.master (or whatever other custom master page you are working with) and give it a new name like v4_searchcenter.master.
- Edit the new master page and locate and remove the PlaceHolderTitleBreadcrumb. This will allow the pop-out breadcrumb to still function properly:
<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> - Next, add the PlaceHolderTitleBreadcrumb back right before the PlaceHolderMain. This will allow the search center to inject the search box in a good location:
<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server"></asp:ContentPlaceHolder>
<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server"/> - Move PlaceHolderPageTitleInTitleArea (and any supporting HTML) to a hidden panel because this placeholder isn’t used the same way in the search center:
<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" />
<asp:Panel visible="false" runat="server">
<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" />
</asp:Panel> - For v4.master you will also want to remove ClusteredDirectionalSeparatorArrow and <h2></h2>. It won’t make sense to show these at the top now:
<SharePoint:ClusteredDirectionalSeparatorArrow runat="server"/><h2></h2> - Next, several lines of CSS need to be added to make sure things look right for the search center. You can add them to the <head> section of the master page:
<style type="text/css">
5. Save the new master page, and check in / publish as a major version and approve it. Apply this master page to only the search center, and apply it as site master page while leaving system master page set as v4.master.
/* remove left margin */
.s4-ca {
margin-left: 0px;
}
/* remove gray background at top (optional) */
.srch-sb-results {
background:transparent none repeat scroll 0 0;
}
/* clean up top padding on 1st search page */
.srch-sb-main {
padding-top: 20px;
}
/* remove centering on 1st search page (optional) */
.srch-sb-results4 {
margin: inherit;
padding-left: 20px;
}
/* remove background color on 1st search page (useful for colored designs) */
.ms-bodyareaframe {
background-color: transparent;
}
/* ------------------------------------------ */
/* -- CSS that may be req. to reset the search styling -- */
/* ------------------------------------------ */
/* fix height of area above search results */
td.ms-titleareaframe, div.ms-titleareaframe, .ms-pagetitleareaframe {
height: auto !important;
}
/* fix border color on search results */
.ms-main .ms-ptabrx, .ms-main .ms-sctabrx, .ms-main .ms-ptabcn, .ms-main .ms-sctabcn {
border-color: #eeeeee;
}
/* fix arrangement of body area on search results */
.srch-sb-results {
height: auto;
}
/* fix positioning of prefs and advanced link on results */
.ms-sblink {
display:block;
}
/* fix the color of the prefs and advanced link on results */
.ms-sblink a:link, .ms-sblink a:visited, .ms-sblink a:hover {
color:#0072BC;
}
</style>
UPDATE: Some commenters have pointed out that if you want to edit pages in the Search Center (and who doesn’t?) these changes result in a double ribbon scenario. I haven’t fully tested this fix, so I’d be curious to hear about the results, but it looks like this would fix it:
- Add <asp:ContentPlaceHolder id="PlaceHolderGlobalNavigation" runat="server"/> to the hidden panel.
- Remove <div id="s4-ribboncont">…</div> and ALL of its contents.
- Add in its place this line: <asp:ContentPlaceHolder ID="SPNavigation" runat="server"></asp:ContentPlaceHolder>
This should fix the double ribbon issue, but you also LOSE the top popout breadcrumb and the quick edit/save button at the top left of the ribbon.
Here are screenshots of the final result:
You can employ these same techniques on your own master pages to create search center specific branding.
If you had trouble following the code changes you can download the completed v4 search center master page: v4_SearchCenter.zip



27 comments:
Hello Randy,
Very nice and informative post. Just one question.
You have used Enterprise search center, basic search center or FAST search center
The example shows Enterprise search center but I believe the other two would work the same. Note, I haven't done much testing in Foundation yet. There could be something funky there.
Thank you! Very helpful! How come the quick launch menu doesnt show up?
Jeff: The default behavior of the search pages is to hide the left navigation and use the full page width to display search results. I'm sure you could work around this if you wanted, but it might need some massaging.
Hello,
When your book "Professional SharePoint 2010 Branding and User Interface Design" will be published ?
Seems that I need to read that from page to page
Randy,
I’m rather new when it comes to branding SharePoint sites, but as far as my quick launch problem goes I have been struggling to say the least. I have been making various changes to the searchmain.aspx page but have yet to achieve the results I want. Could you point me in the right direction?
Also, I have noticed when I click on either of the tabs on the search page another ribbon appears briefly then it goes away? It’s a minor issue but I am worried my client will find it annoying.
Your blog has been a huge help during this process and I for one will definitely be picking up a copy of your book.
Thanks!
Hi Randy,
Every week Amazon notifies me of a new shipping date of your book. Just to say, we are waiting for it !!! :)
Keep up the good work ! Great work.
Best,
Julien
@neodante - I know... Sorry about that everyone. I thought we were locked on the date, but recently it just went crazy. Wrox doesn't send me updates so I see it on Amazon like everyone else. I don't want to curse it, but I THINK it's not moving anymore.
Randy, don't worry: we all know that writing a book is a huge work. Hope to see you at the Summit.
Julien (I dont' know why my pseudo on your blog is neodante...)
Great post Randy - followed the steps and got the results I wanted in no time.
Just one question: Is there any way to get the same global navigation on the search site as on other sites in the same site collection?
Hey Randy, great article. Could you distinguish in more detail what you mean by setting the master page as a site master page while leaving the v4.master as a system master page?
Thanks
-Tyler
Tyler,
When you go to site settings --->master page, you have the option of setting both the site master page and system master page.
site master page- all the publishing pages
system master page- all the forms and view pages
Hope that helps
Thanks for clarifying Jeff
Hi Randy,
Another great post.
Just a note. Something to be aware of when using this technique with the Basic Search Center is that the default provisioned pages (default.aspx, results.aspx etc) have code for the ribbon embedded in them. Using the technique above you end up with two ribbons and a whole lot of confusion on the page. What I've done in these cases is simply remove the ribbon container & ribbon code from the master page as it's handled by the pages themselves.
This is only applicable to the basic search template as the enterprise and fast search templates utilise the ribbon provided by the masterpage.
Cheers
Pete
great post.. Thanks randy..
It doesn't work for WSF 2010 + Search Server Express 2010 Basic Search Center. If you change the master page using WSF Master Page pickers like OrbitOne you does not view the global navigation menu and almost all action in "Look & feel" and "Site Action" generate an error.
@ Peter,
I have two ribbons showing up on my search page as well. I tried what you suggested, and it broke my search page. I removed the ribboncont div tag and all its contents.
I just applied the above steps to SP Foundation 2010 and Search Server Express 2010 using a basic search center and it WORKED LIKE A CHAMP:)
Perhaps a difference for me... I installed the search center as a subsite of my main. When checking back in the v4.master (new one) I marked it as custom master in Designer. Boom! Awesome.
Thanks man! Easy steps! I'll be ordering your book too!
I have done this and it worked great for applying my custom Master Page to the Search Center. However, the problem I'm having is that I don't get any search results as an anonymous user, but authenticated it works perfectly. I've checked to make sure that everything is set to crawl and that crawl should index all aspx pages regardless of permissions, but I still get nothing...anyone have any ideas?
Great post, very useful in getting me out of a bind with a customer! Keep up the fantastic work.
For everyone having issues with double ribbon, I added an UPDATE to the post. I haven't fully testd it, let me know what you think.
This should work as well to eliminate the double ribbon.
- Don't delete anything from the master.
- In your css, add:
body #s4-ribbonrow div#s4-ribbonrow {
display:none;
}
It should be gone now without deleting any of the stuff in the top ribbon
I'm still testing if it doesn't delete anything on other pages or places, but so far it looks ok.
Thanks Randy, this issue was a show stopper for the Migration from 2007 to 2010 for a major client.
My Hero!!! :)
Randy...thank you so much for this article. It was a great help. Much appreciated.
in reply to my own previous post:
this fixed the yellow bar issue
#s4-statusbarcontainer {
display: none;
}
and I didnt notice the double bar pushing the "add webpart" menu down, but Tim's CSS fix above did the trick...
body #s4-ribbonrow div#s4-ribbonrow {
display:none;
}
now my site search site is nice and functional ;)
I did almost the same as Tim, only to find out that I should have read more of the comments:
* Hide second ribbon */
#s4-ribbonrow > div.s4-ribbonrowhidetitle {
display: none;
}
I did it yet another way - again I should have finished reading first perhaps!
/*hide any s4-ribbonrowhidetitle elements whose parents are s4-ribbonrowhidetitle elements*/
/*(eliminate double ribbon)*/
.s4-ribbonrowhidetitle > .s4-ribbonrowhidetitle
{
display:none;
}
Post a Comment