SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to remove the "This site: " prefix from the OOTB contextual search scope. I realise I could hack this with JavaScript, however does anyone know of a supported way to achieve this?

share|improve this question

The only other option I could see is full customization. Deploy a feature that customize the search options so the contextual search is not displayed. Create custom search scopes, and custom search pages. You could additionally add custom search queries to "mimic' contextual search scopes. Package as a solution and deploy.

I think JavaScript will get you where you want faster. You can package the the JavaScript up as a feature so it will scale with your sites.

share|improve this answer
up vote 1 down vote accepted

For those interested, here is the very simple JavaScript that will achieve this for you. You will need to place this wherever your search box appears (e.g. on your masterpage) and you will need to have a reference to the jQuery plugin.

$(document).ready(function () {
    var $scopesDropDownList = $(".ms-sbscopes > SELECT");

    if ($scopesDropDownList.length) {
        // Convert the jQuery object to a native JavaScript object.
        var scopesDropDownList = $scopesDropDownList[0];

        // Rename the contextual list and site scopes.
        for (var i = 0; i < scopesDropDownList.options.length; i++) {
            var item = scopesDropDownList.options[i];

            if (item.value == "This Site")
                item.text = item.text.substr("This Site: ".length);
            else if (item.value == "This List")
                item.text = item.text.substr("This List: ".length);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.