Skip to content

Commit

Permalink
Update coveo_template.js
Browse files Browse the repository at this point in the history
  • Loading branch information
wei-harness committed Jan 6, 2023
1 parent 85fa598 commit cd1c5f4
Showing 1 changed file with 66 additions and 1 deletion.
67 changes: 66 additions & 1 deletion js/coveo_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ const baseTemplate = `
<div class="harness-search-module">
<span class="CoveoFieldValue#{moduleClassName}" data-field="@commonmodule" data-text-caption="" data-with-label="false"></span>
</div>
<div class="harness-search-gen">
<span class="CoveoFieldValue" data-field="@categoryname" data-text-caption="" data-with-label="false"></span>
</div>
</div>
</div>
</div>
Expand All @@ -55,6 +58,7 @@ const CoveoFieldValueFF = " CoveoFieldValueFF";
const CoveoFieldValueCE = " CoveoFieldValueCE";
const CoveoFieldValueSTO = " CoveoFieldValueSTO";
const CoveoFieldValueSRM = " CoveoFieldValueSRM";
const CoveoFieldValuePlatform = " CoveoFieldValuePlatform";

const tagName = "@commonsource";
const tagNameFirstGenDocs = "@categoryname";
Expand Down Expand Up @@ -271,6 +275,36 @@ Coveo.TemplateCache.registerTemplate(
true
);

Coveo.TemplateCache.registerTemplate(
"ResultWithImage-Platform",
Coveo.HtmlTemplate.fromString(
createStringFromTemplate(baseTemplate, {
imageCell: withImage,
moduleClassName: CoveoFieldValuePlatform,
imagePlaceHolder: imagePlaceHolder,
tagFieldName: tagName,
}),
{
condition: null,
layout: "list",
fieldsToMatch: [
{
field: "featuredimage",
values: [],
},
{
field: "commonmodule",
values: ["Harness Platform"],
},
],
mobile: null,
role: null,
}
),
true,
true
);

// Defult template for results with featured images
Coveo.TemplateCache.registerTemplate(
"ResultWithImage",
Expand Down Expand Up @@ -526,7 +560,37 @@ Coveo.TemplateCache.registerTemplate(
true
);

/* ---------- Results Without Image - FirstGen Docs ---------- */
Coveo.TemplateCache.registerTemplate(
"ResultWithoutImage-Platform",
Coveo.HtmlTemplate.fromString(
createStringFromTemplate(baseTemplate, {
imageCell: withoutImage,
moduleClassName: CoveoFieldValuePlatform,
imagePlaceHolder: withoutImage,
tagFieldName: tagName,
}),
{
condition: null,
layout: "list",
fieldsToMatch: [
{
field: "uri",
values: [],
},
{
field: "commonmodule",
values: ["Harness Platform"],
},
],
mobile: null,
role: null,
}
),
true,
true
);

/* ---------- Results Without Image - FirstGen Docs
Coveo.TemplateCache.registerTemplate(
"ResultWithoutImage-FirstGen-Docs",
Expand Down Expand Up @@ -557,6 +621,7 @@ Coveo.TemplateCache.registerTemplate(
true,
true
);
---------- */

// Defult template for results without featured images
Coveo.TemplateCache.registerTemplate(
Expand Down

0 comments on commit cd1c5f4

Please sign in to comment.