Removing the Community filter from the Search Results Page Sidebar

Beantwortet

5 Kommentare

  • Ifra Saqlain
    Community Moderator

    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

    Team

    1
  • Robert De La O

    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?

    0
  • Ifra Saqlain
    Community Moderator

    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-list

     

    First, 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 :)

     

    Team 

    1
  • Robert De La O

    Amazing! Thank you. This worked. :)

    0
  • Ifra Saqlain
    Community Moderator

     :)

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Powered by Zendesk