Friday, July 20, 2012

Issues in V4.master based Custom Master Page in SharePoint Search Center

Search Center master pages are based on minimal.master and these sites do not have v4.master or nightandday.master applied to them. If we create a custom master page based on v4.master and apply it to one of the search center sites, we can notice two main issues.
1.    Webpart Add button is not visible when editing a page in search center
2.    There are two blue ribbon bars and two site actions buttons

This is because the search center page layouts and pages are created specifically to work with minimal.master. The minimal.master does not provide any of the usual navigation and location controls. On the other hand default search center page layouts provide their own ribbon row using the SPNavigation content placeholder.
Solution: Adding below Jquery in our custom master page fixes both the problems.
<script type="text/javascript">
    $(document).ready(function () {
        $("#s4-ribbonrow").children("div").each(function () {
            if ($(this).attr("id") == "s4-ribbonrow")
                $(this).hide();
        });
    });
</script>

No comments: