Coveo card view on mobile with default template

104 views Asked by At

I've been asked to disable the card view for a search result page. I know nothing about Coveo, but i have determined that for mobile the list view is prefered over card view. This is being implemented in a AEM 6.3 template.

In CoveoJsSearch.js, starting at line 17728 I have the following:

         if (merged.responsiveComponents.isSmallScreenWidth()) {
             templates = _.filter(templates, function (tmpl) { return tmpl.layout == 'card'; });
             merged.currentLayout = 'list';
             this.layout = 'list';
         }

I changed these to list from card and it does what i want, but this looks JS file looks like it's 'compiled' from the front end framework. So what is the best way to ensure mobile users see a list view rather than a card view for search results.

1

There are 1 answers

0
estaples On

Coveo now provides easy control for this through your search page template:

https://connect.coveo.com/s/article/13748

So for your case (showing list view only at mobile), you'd likely want:

<div class="coveo-result-layout-section">
     <span class="CoveoResultLayout" data-mobile-layouts="list"></span>
</div>