7

My pages have a bit at the top of each with a privacy notification window, that the individual user dismisses with a click. However, this is getting indexed into Coveo and, being at the top, shows as the text for each search item on a result page.

The content renders from a particular template/field. Is there a way to exclude either this field, template, or its rendering on the page from Coveo's crawl?

2 Answers 2

9

If you are using the HtmlContentInBodyWithRequestsProcessor, this text is most likely indexed in the content of your page.

Since the September release (4.0.402), Coveo for Sitecore has two new parameters that you can set to ignore parts of your HTML content by adding the StartCommentText and EndCommentText nodes in your configuration:

<processor type="Coveo.SearchProvider.Processors.HtmlContentInBodyWithRequestsProcessor, Coveo.SearchProviderBase">
    <StartCommentText>BEGIN NOINDEX</StartCommentText>
    <EndCommentText>END NOINDEX</EndCommentText> 
</processor>

You can then add the nodes like so in your HTML page:

<!-- BEGIN NOINDEX -->
<p>This section will not be indexed.</p>
<!-- END NOINDEX -->
<p>This section will be indexed.</p> 

For more information, refer to this page.

This processor is an implementation of the CleanHtmlContentInBodyProcessor coded by our Coveo for Sitecore guru @jflheureux. If you are using an earlier version, you can add this processor to your code and reference it in your configuration after the HtmlContentInBodyWithRequestsProcessor.

Another solution would be to add conditional rendering for this page section. Coveo for Sitecore uses the Coveo Sitecore Search Provider user agent. It could be detected and used to hide the sections you don't want to be indexed.

A third solution would be to define a special device and layout combination for that user agent, but it requires to duplicate the layouts and controls, and is quite harder to maintain than the other two solutions.

Hope this helps :)

1
  • 2
    I'm using the latest Coveo for Sitecore, so that first option was perfect. Thanks. Commented Nov 3, 2016 at 19:44
2

I had a similar issue on a project where error messages were being indexed. I solved the issue by overwriting the visualization field with my own custom computed field that excluded any content I didn't want indexed. I wasn't using Coveo, but I assume you could do something similar. You can read about the implementation details here: http://jockstothecore.com/searching-page-datasources/

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.