2010, Development Blog, SharePoint
Custom-branding a FAST Search Center (how to fix the search box and dual-site actions menu)
For those of you who are branding a FAST Search Center in SharePoint 2010, you might have come across 2 interesting quirks when using a masterpage other than the OOTB minimal.master (which happens to be the same as the minimal.master included in any regular site):
- The search box is rendered outside of the body area (in the breadcrumb tag)
- 2 Site Actions menus are rendered
This is a common issue when starting from v4.master (I am reusing a highly customized masterpage that was based off of v4.master).
First, let’s tackle the search box:
Using v4.master as a starting point, find the following tag:
<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server">
Leave all the code inside of it where it’s at. Move this tag and its closing tag to in between
<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server">
This allows your ribbon to function normally, leaves the breadcrumb controls in place, and takes the search box out of the ribbon and places it at the top of the content area. One last thing to take care of is the Search box in the master page. Add Visible=”false” to the following tag:
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">
This hides the search that will be deactivated anyway, leaving remnants of a search area (you can also hide the wrapping container with CSS).
Next, let’s fix the dual Site Actions menu bar:
In a normal SharePoint 2010 site, the Site Actions menu is generated by the second <SharePoint:SPRibbonPeripheralContent…> (there are 2 tags – this is the first, with class ms-siteactionscontainer) tag.
The 2nd Site Actions menu you see in a FAST Search Center is generated inside the <asp:ContentPlaceHolder ID=”SPNavigation” runat=”server”> tag.
Which do you use, and which do you hide?
- The tag with ID=”SPNavigation”:
- is generally used to generate items related to the Ribbon and navigation,
- is necessary for the Global Navigation (tabs for Page, Browse, Publish, etc.);
- is not designed to share space with any other controls (such as the Welcome, breadcrumb, tagging, or any other custom additions);
- renders empty when in Site Actions;
- The <SharePoint:SPRibbonPeripheralContent tag:
- renders Site Actions menu, page state buttons (Save, Edit, etc.) and site map (folder icon with drop-down breadcrumb)
- does not generate the Global Navigation;
- is designed to share space with other controls (so you can inline other content like logo, welcome box, etc.)
- renders Site Actions everywhere
You don’t need both tags – you can dump the <SharePoint:SPRibbonPeripheralContent menu altogether, but doing so can remove functionality your users might expect (the short list above). SPNavigation is required for the SharePoint masterpage to render (it will error out without it).
To get the best of both worlds:
- Keep the <SharePoint:SPRibbonPeripheralContent tag where it is at
- Move the Publishing Console out of the SPNavigation tag (leave it in the same place it’s in currently)
- Move the empty SPNavigation tag to the very bottom of your page – that’s it.
- Side-note: although you will be tempted, do not Visible=”false” or style=”display:none” the tag – this will cause your Global Navigation tabs to not display)
Comments are closed