Removing the Community filter from the Search Results Page Sidebar
답변함We currently use community for certain specific topics/conversations and have no need to filter by it on the Search Results page in Guide. Does anyone know the code to suppress this from the filter list?
-
Hey,
You can do two things:
1st : Remove this code on search result page
{{#if help_center.community_enabled}}
<section class="filters-in-section collapsible-sidebar" aria-expanded="false">
<h3 class="collapsible-sidebar-title sidenav-title">{{t 'filter_by_type'}}</h3>
<ul class="multibrand-filter-list multibrand-filter-list--collapsed">
{{#each filters}}
<li>
<a href="{{url}}" class="sidenav-item" aria-selected="{{selected}}">
<span class="sidenav-subitem filter-name">{{name}}</span>
<span class="sidenav-subitem doc-count">({{count}})</span>
</a>
</li>
{{/each}}
</ul>
</section>
{{/if}}OR
2nd : Add this CSS code on your stylesheet.
.search-results-sidebar .filters-in-section:last-child {
display:none
}If any query let me know :)
Thank You
-
Thanks, Ifra.
I did do the first section of code prior to posting but then it removes the sidebar completely which means the Category filters are removed as well.
Do you know if there is a way to remove the communities filter but leave the articles filter so the categories are available?
-
Okay, revert all changes you have done( I told above ) . Just need to add script code for this.
You can only add this code on search_result.hbs template at the bottom:
<script>
$(document).ready(function (){
$( ".search-results-sidebar .multibrand-filter-list li:contains('Community')" ).hide();
});
</script>
// I hope you have these same classes if not so you can update these
.search-results-sidebar .multibrand-filter-listFirst, add jquery lib on your document_head.hbs template
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
If any issue let me know :)
-
Amazing! Thank you. This worked. :)
-
:)
댓글을 남기려면 로그인하세요.
5 댓글