How to show detailed description on Search results

Created by Ezra Weinstein, Modified on Tue, 13 Sep 2022 at 02:49 PM by Hannah Harris

By default, the search results page displays only the name of the grouping that you are browsing by (e.g. a manufacturer, a department, a category group, etc.). For SEO purposes, you may want to add some content to that header to drive traffic to those product pages. You can do this by populating the Detailed Description field in the taxonomy item you want to optimize.


For example, to add content to the product category group "Rifles", go to Products > Taxonomy > Category Groups and click on the Rifles Category.  Enter the HTML you want in the Detailed Description field.



You will need to do this for every product grouping that you want to optimize.


Then, go to Website > Pages > Pages, and find the Product Search Results page.  In the Javascript tab, there should be a function called afterDisplaySearchResults. It should look something like this:



Make the following changes (highlighted in green):



The code is included below to copy and paste:


    if (empty(pageGroupingData['description'])) {         $('#category_banner').remove();     } else {         if(empty(pageGroupingData['detailed_description'])) {         $('#category_banner h1').html(pageGroupingData['description']);         } else {             $('#category_banner h1').replaceWith(pageGroupingData['detailed_description']);         }         if (empty(pageGroupingData['image_url'])) {             $('#category_banner').find('img').remove();             $('#category_banner').removeClass('banner');         } else {             $('#category_banner img').attr('src', pageGroupingData['image_url']);         }     }


After this change is done, you will see the detailed description in the header when browsing:


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article