4

If a SharePoint 2013 Search does have no results, the following text is displayed:

Preference for results in English - Choose your search language.

Nothing here matches your search

Suggestions
•Make sure all words are spelled correctly
•Try different search terms
•Try more general search terms
•Try fewer search terms
•Try these tips for searching

How can I customize this text?

1 Answer 1

7

You need to change Search Display Template. Search Results web part uses the "Control_SearchResults.html" display template that is available under the Master Page Library/Display Templates/Search.

  1. Download a copy of that template (preferably, if you don't want to change the ootb one)
  2. Open the file in Notepad (or any other text editor)
  3. Replace the following line - "var emptyMessage = ctx.ClientControl.get_emptyMessage();" (in my environment it's line no. 347) with the text you want to be shown.
  4. Save the file, upload it back to Master Page Library/Display Templates/Search folder, check it in. A .js file with the same name should be created automatically.
  5. If you used a different name for your template, you will need to update search web part as well. Go to your page where the Search Result web part is, edit the Search results web part. Under the Display Templates section select the newly uploaded display template.
5
  • use SharePoint Designer to edit those files Feb 16, 2016 at 16:11
  • Danny, it's a plain HTML file, any text editor will work. I prefer Notepad++ due to friendly syntax highlight. Feb 16, 2016 at 16:12
  • 2
    Yes, but Designer doesn't need step 2 and helps with all the stuff from step 4. And Display Templates (the code in HTML comments) do not have syntax highlighting in any editor because someone stupid at Microsoft decided to put code in HTML comments Feb 16, 2016 at 16:15
  • 2
    I prefer Notepad++ as well. I encourage the download/upload approach so you don't overwrite the original files. Feb 17, 2016 at 19:59
  • While not wrong, you can also set the EmptyMessage on the Search Result Webpart. Export the WebPart, set the EmptyMessage upload the webpart again and replace the original. Also see sharepoint.stackexchange.com/questions/74589/…
    – Dennis G
    Sep 26, 2019 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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