Need To Hide Help Category Block from End-Users Only

2 コメント

  • Ifra Saqlain
    Community Moderator

    Hi Owen, Follow these simple steps to achieve this:

    Step 1: To get category-ID so need to add this category-id-{{id}} inside your category block's code on your home_page.hbs. 

    {{#each categories}}
    {{#if ../has_multiple_categories}}
    <li class="blocks-item category-id-{{id}}"> // To get category-ID category-id-{{id}}
    <a href='{{url}}' class="blocks-item-link">
    <span class="blocks-item-title">{{name}}</span>
    <span class="blocks-item-description">{{excerpt description}}</span>
    </a>
    </li>
    {{else}}
    {{#each sections}}
    <li class="blocks-item">
    <a href='{{url}}' class="blocks-item-link">
    <span class="blocks-item-title">
    {{name}}
    </span>
    <span class="blocks-item-description">{{excerpt description}}</span>
    </a>
    </li>
    {{/each}}
    {{/if}}
    {{/each}}

     

    Step 2: Copy the below code and paste at your script.js file.

    if (HelpCenter.user.role=='end_user') { 
    var specificcategory = document.querySelector('.category-id-60002934000'); // This bold number is the category ID, you need to update this as per your category ID.
    specificcategory.style.display = 'none';
    }


     

    Step 3: To get category ID, click on that and get the ID from search-bar eg. 

    https://xyz/hc/en-us/categories/60002934000-xyz

    Now your specific category-block will be hidden to end-users.

     

     

    Team

    1
  • Everest Theme

    Hey Owen Calvert

    If you wanna hide the 'Agent Knowledge Capture' from the end-user you just need to make that category to draft then that category will only visible to the Agent and Admin users 

    Hope this will work for you 

    Thanks 

    0

サインインしてコメントを残してください。

Powered by Zendesk