0

I am using Coveo triggers on my search page. I have added one notify trigger in my Query pipeline.

For ex: If query is "test" show the notification "Your query is test". That notification string is coming from Covoo admin console, when we set the trigger it gives us an option to add the notification string.

My question is, can we modify the html of this notification from coveo admin console? For ex: If I want to add some links in my notifications.

I am using coveo atomic for search results page.

2 Answers 2

0

The string that comes from the Coveo Admin Console supports full HTML. You can add whichever HTML you want there, and it will be rendered on the front end.

0

We were able to do that in our sitecore component using Atomic Coveo but not sure this is the best approach.

First we import the buildNotifyTrigger

import {buildNotifyTrigger} from 'https://static.cloud.coveo.com/atomic/v2/headless/headless.esm.js';

Added one div with id="contentDiv", where I want to show the notification html and then after initializing the search interface added below code.

const notifycontroller = buildNotifyTrigger(engine);
        notifycontroller.subscribe(() => {
            const { notifications } = notifycontroller.state;    
            var divElement = document.getElementById("contentDiv");
            divElement.innerHTML = ''
            var divElements = notifications.map(function (content) {
                var divElement = document.createElement("div");
                divElement.innerHTML = content;
                return divElement;
            });
            divElement.append(...divElements); 
        });

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.