Gravatar for

Question by Diego, Dec 18, 2014 12:12 PM

Coveo for sitecore javascript doubt


on my index I have the following field: @fpagez32xtitle64418 this field is indexed as a string

On my sublayout I am trying to render it but I don´t know the syntax to render it. I have tried the following but none seem to work: =raw.<%= ToCoveoFieldName("@fpagez32xtitle64418", false) %> }} =raw.<%= ToCoveoFieldName("pagez32xtitle", false) %> }} =raw.<%= ToCoveoFieldName("pageztitle", false) %> }}

I'm not sure how the syntax work here. I'm learning so I'm not that familiar with it´s syntax. thanks

1 Reply
Gravatar for

Answer by Jean-François L'Heureux, Dec 18, 2014 1:01 PM

You can do that simply by using a table with the CoveoFieldTable class and tr elements with the right data attributes (see Displaying a Field).

Gravatar for

Comment by Diego, Dec 18, 2014 1:03 PM

thank you. What if html tables are not accepted say I want to render within a div or a p element?

Gravatar for

Comment by Luc Bergeron, Dec 18, 2014 1:06 PM

Also, I would add that you should pass the field name (as seen in Sitecore) to the "ToCoveoFieldName" method. In your case, the call will look like this:

ToCoveoFieldName("page title", false)

So calling this in the result template should work fine:

{{ =raw.<%= ToCoveoFieldName("page title", false) %> }}

Gravatar for

Comment by Diego, Dec 18, 2014 4:55 PM

thank you. this works!

Ask a question