Gravatar for info@eat-sleep-code.com

Question by eat-sleep-code.com, Oct 19, 2017 5:51 PM

Adding existing source to "Names of External Content Sources:" in Coveo for Sitecore results in script being displayed as raw text in page.

I am using Sitecore 8.2 Update 2 with Coveo for Sitecore 4.1.82.12 (Enterprise Cloud).

We have an existing Website datasource called "Blog" configured in Coveo Administration Console.

When I add that to the Names of External Content Sources and save/publish all the blog results are shown (oddly all seem to be at the top of the list), but also displayed above the results is the raw text:

<em>if (Html.Coveo().IsEditingInPageEditor()) {External Content
} }</em>

I inspected the page source in Chrome and see:

<div>
  <div id="_737F456C-D32E-4531-B0FD-1B1FB6AB3C9C" class="CoveoForSitecoreFilterExpression" data-sc-filter-scope-node='{"advanced" : {"Type" : "false"}}'></div>
</div>
<div>
  if (Html.Coveo().IsEditingInPageEditor()) {
    <div>External Content</div>
  }
  <span class="CoveoForSitecoreExternalContent" data-sc-sources='Blog'></span>
  }
</div>
<br>

Thanks

1 Reply
Gravatar for flguillemette@coveo.com

Answer by François Lachance-Guillemette, Oct 19, 2017 5:58 PM

The `if (Html.Coveo().IsEditingInPageEditor()) {External Content } }` part is a small typo that was introduced in your version, no worries about that, it is simply missing a `@` to execute the `if` section server-side. :)

You can add this missing `@` in `YOUR_WEBSITE/Views/Coveo Hive/Scopes/External Content.cshtml`.

The important part is `<span class="CoveoForSitecoreExternalContent" data-sc-sources='Blog'></span>`, which is a component that adds external sources in the expression. If you check the network tag, a new expression should be added in the `advancedExpression` part that matches your external source.

Gravatar for info@eat-sleep-code.com

Comment by eat-sleep-code.com, Oct 19, 2017 6:20 PM

Thanks. I figured that was it, but wanted to be sure the issue was raised in case it was something more specific to my implementation.

Any idea why every blog entry is appearing on top (above any of my Sitecore results), regardless of it's age?

Gravatar for info@eat-sleep-code.com

Comment by eat-sleep-code.com, Oct 19, 2017 6:34 PM

@François Lachance-Guillemette

ALT double-clicking on the result like a mad-man over here. Only thing that happens is that it selects the whole word. :-)

Gravatar for info@eat-sleep-code.com

Comment by eat-sleep-code.com, Oct 19, 2017 7:47 PM

@François Lachance-Guillemette

Yup. I have tried on the page as well as in Experience Editor? Or should I be doing this from some other screen?

Ask a question