Using the no index rules available with the site search feature

Updated on 20-October-2016 at 10:16 AM

Business Catalyst End of life announcement - find out more details.

Introduction

The Site Search has a handy "noindex" feature that allows you to selectively hide blocks of page content from being indexed and returned in your search results.

There are a bunch of useful applications for this feature, including sites where you're hiding certain page elements based on "logged in" status or country code.

In this article, we'll present a case study of a situation where the feature might be used and show you how to implement it in just a few minutes.

Step 1. Select The Elements to Hide

Let's say we have run a travel website with articles and advice on travelling to certain holiday destinations. The articles are in the form of web pages and can be quickly found using a site-wide search we've set up.

The problem is that we've also inserted an "Inquiry" web form on a page which includes a "Country" select box. By default, the search feature will crawl and index the entire HTML document, so if a visitor was to search "Fiji", the web form would also be returned in the results, as the option "FIJI" exists in the drop-down.

The solution to our problem? Wrapping a "noindex" rule around the web form, telling the system not to index its contents. 

Step 2. Add the "cat-noindex" class

Hiding content from being indexed is as easy as adding the "cat-noindex" class to the element you'd like to hide. 

                

For our web form, we'll wrap a DIV with the "cat-noindex" class assigned around the form element.

It's important to make sure you scroll to the end of the form element and also close the DIV tag.

Step 3. Save & Test!

Once we've assigned the "cat-noindex" class to all the page elements we'd like the system not to index, we'll save and publish the page.

                                             

The next step is to test out our search! If we enter the word "Fiji", you'll notice that our web form page is no longer being returned in the results, as the form element containing the keyword is no longer being indexed.

                                                     

Make sure you allow a couple of hours for the changes to be reflected, as the re-indexing process is not always instant. If your hidden elements are still showing up in the search results, try initiating a re-index manually via Modules > Site Search > Re-index Entire Website.

Please note: This feature currently works only on full HTML pages which include valid BODY tags.