Hiding content from search results by using “display:none or noindex” in Sharepoint Search 2013

Below is a critical tip that is gone, I believe, unnoticed for Sharepoint Search 2013.

Sample Scenario

Let’s say you want to show a list of countries by using an accordion control.   The control is shown collapsed when it is first downloaded from the server. 

Collapsed state (default)

image

Expanded ( after explicit user interaction)

image

The problem

The text in the accordion items are not included in the search results by no means.  

I found no information about the solution of this problem by any resource on the web. So, I had to discover it by intuitive experimental diagnosis and thought it will be useful to share it on the web for those who have the same problem.

Solution

You should set display:none property by css file reference instead of inline css style setting.

The critical information is that Sharepoint 2013 Search crawler doesn’t process texts under tags where inlinedisplay:none” styling is set.  The effect is recursive to inner tags as well.  But the crawler processes the content as expected if display:none property is set by external css file reference.  You should consider using setting display:none from an external css file if you want to load the content invisible by default. 

image

Additional information

You may want to exclude the content from search results.  In this case, setting display:none property inline may be your friend.   However, if you want to show the content yet exclude it from search result you should use noindex class.

image

Note: noindex class will only effect the text of the node it was assigned to.  It is not effective recursively, so, it won’t effect the inner nodes of noindex tag.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s