Show Help Centre article based of geolocation

7 コメント

  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    Hi Anton :), show articles based on geolocation is tricky, you can do one thing; create a special category and create your special articles in it; you can apply user segment for these articles or these article can be locale based I mean that category and articles of this can be locale based.

     

    I didn't set my geolocation on my laptop when I wrote geolocation code, I got an alert to turn on also my location is not set on my laptop so I ggot wrong city basis of my device location so I don't think it's a right way.

    May be someone else give solution better than me but I think you should try locale based category with the articles or use user segment.

     

    Thanks

    Ifra

     

     

    0
  • Anton Van der meyden

    Ifra Saqlain 

    Hello,

    Thank you for the suggestion.

    I will try this.

    Kind Regards,

    Anton

    0
  • Anton Van der meyden

    Ifra Saqlain

    Hello,

    A user segment would require a tag or defining feature for the end user to access it which would then mean that the customer profile in Zendesk needs that tag on it.

    Or can the user segment be setup a different way?

    Thank you.

    Kind Regards,

    Anton

    0
  • Anton Van der meyden

    Ifra Saqlain

    Hello,

    I tried hiding the category using this support article but none of the examples seem to work. My preferred option is the ist tags.

    https://support.zendesk.com/hc/en-us/community/posts/4409515323802-How-do-you-hide-a-category-from-the-homepage-

    See below where they have been added to my script. I also used category number instead of the name

    <section class="section knowledge-base">
        <h2 class="visibility-hidden">{{ t 'categories' }}</h2>
        <section class="categories blocks">
          <ul class="blocks-list">
            {{#each categories}}
            
    {{#isnt name 'Account'}}

              {{#if ../has_multiple_categories}}
                <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}}
            
            {{/isnt}}

            {{/each}}
          </ul>
          {{pagination}}
      
        </section>

     

    Can provide the full script if required.

    Thank you.

    Kind Regards,

    Anton

    0
  • Anton Van der meyden

    Ifra Saqlain

    Hello,

    I have decided to just the article instead.

    I managed to hide the category and sections but can't hide one particular article in a section.

    I tried this from the section tab with the following code but the article still displays.

    Can you assist please?

    <div class="container-divider"></div>
    <div class="container">
      <nav class="sub-nav">
        {{breadcrumbs}}
        <div class="search-container">
          <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" focusable="false" viewBox="0 0 12 12" class="search-icon">
            <circle cx="4.5" cy="4.5" r="4" fill="none" stroke="currentColor"/>
            <path stroke="currentColor" stroke-linecap="round" d="M11 11L7.5 7.5"/>
          </svg>
          {{search scoped=settings.scoped_kb_search submit=false}}
        </div>
      </nav>

      <div class="section-container">
        <section id="main-content" class="section-content">
          <header class="page-header">
            <h1>{{section.name}}</h1>
            {{#if settings.show_follow_section}}
              <div class="section-subscribe">{{subscribe}}</div>
            {{/if}}
            {{#if section.description}}
              <p class="page-header-description">{{section.description}}</p>
            {{/if}}
          </header>

          {{#if section.sections}}
            <ul class="section-list">
              {{#each section.sections}}
               {{#isnt id 9772307245330}}


              <li class="section-list-item">
                  <a href="{{url}}">
                    <span>{{name}}</span>
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" focusable="false" viewBox="0 0 16 16" aria-hidden="true">
                      <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5 14.5l6.1-6.1c.2-.2.2-.5 0-.7L5 1.5"/>
                    </svg>
                  </a>
                </li>

                {{/isnt}}


              {{/each}}
            </ul>
          {{/if}}

          {{pagination "section.sections"}}

          {{#if section.articles}}
            <ul class="article-list">
              {{#each section.articles}}
                <li class="article-list-item {{#if promoted}} article-promoted{{/if}}">
                  {{#if promoted}}
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" focusable="false" viewBox="0 0 12 12" class="icon-star" title="{{t 'promoted'}}">
                      <path fill="currentColor" d="M2.88 11.73c-.19 0-.39-.06-.55-.18a.938.938 0 01-.37-1.01l.8-3L.35 5.57a.938.938 0 01-.3-1.03c.12-.37.45-.63.85-.65L4 3.73 5.12.83c.14-.37.49-.61.88-.61s.74.24.88.6L8 3.73l3.11.17a.946.946 0 01.55 1.68L9.24 7.53l.8 3a.95.95 0 01-1.43 1.04L6 9.88l-2.61 1.69c-.16.1-.34.16-.51.16z"/>
                    </svg>
                  {{/if}}
                  <a href="{{url}}" class="article-list-link">{{title}}</a>
                  {{#if internal}}
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" focusable="false" viewBox="0 0 16 16" class="icon-lock" title="{{t 'internal'}}">
                      <rect width="12" height="9" x="2" y="7" fill="currentColor" rx="1" ry="1"/>
                      <path fill="none" stroke="currentColor" d="M4.5 7.5V4a3.5 3.5 0 017 0v3.5"/>
                    </svg>
                  {{/if}}
                </li>
              {{/each}}
            </ul>
          {{else}}
            <i class="section-empty">
              <a href="{{section.url}}">{{t 'empty'}}</a>
            </i>
          {{/if}}

          {{pagination "section.articles"}}

        </section>
      </div>
    </div>

    Thank you.

    Kind Regards,

    Anton

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    Hi Anton, I'm too late I know,

    For section page:

    {{#if section.articles}}
            <ul class="article-list">
              {{#each section.articles}}
              
              {{#isnt id 13018266721940}}
              
                <li class="article-list-item {{#if promoted}} article-promoted{{/if}}">
                  {{#if promoted}}
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" focusable="false" viewBox="0 0 12 12" class="icon-star" title="{{t 'promoted'}}">
                      <path fill="currentColor" d="M2.88 11.73c-.19 0-.39-.06-.55-.18a.938.938 0 01-.37-1.01l.8-3L.35 5.57a.938.938 0 01-.3-1.03c.12-.37.45-.63.85-.65L4 3.73 5.12.83c.14-.37.49-.61.88-.61s.74.24.88.6L8 3.73l3.11.17a.946.946 0 01.55 1.68L9.24 7.53l.8 3a.95.95 0 01-1.43 1.04L6 9.88l-2.61 1.69c-.16.1-.34.16-.51.16z"/>
                    </svg>
                  {{/if}}
                  <a href="{{url}}" class="article-list-link">{{title}}</a>
                  {{#if internal}}
                    <svg xmlns="http://w

     

    For Category Page:

      <div id="main-content" class="section-tree">
            {{#each sections}}
              <section class="section">
                <h2 class="section-tree-title">
                  <a href="{{url}}">{{name}}</a>
                </h2>
                {{description}}
                {{#if articles}}
                  <ul class="article-list">
                    {{#each articles}}
                    
                     {{#isnt id 13018266721940}}
                    
                      <li class="article-list-item{{#if promoted}} article-promoted{{/if}}">
                        {{#if promoted}}
                          <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" focusable="false" viewBox="0 0 12 12" class="icon-star" title="{{t 'promoted'}}">
                            <path fill="currentColor" d="M2.88 11.73c-.19 0-.39-.06-.55-.18a.938.938 0 01-.37-1.01l.8-3L.35 5.57a.938.938 0 01-.3-1.03c.12-.37.45-.63.85-.65L4 3.73 5.12

     

    If your homepage has knowledgebase or private article is showing then you can add condition with the article id just before article LI tag, also you have to add condition on your search_results.page to hide from there as well.

     

    Now you can give direct URL of your private article.

     

    If any confusion please ask :)

    Thanks

     

     

     

    0
  • Anton Van der meyden

    Ifra Saqlain

    Hi Ifra,

    Thank you for the reply.

    I see now what I did wrong.

    This works perfectly.

    Thank you for your help.

    Kind Regards,

    Anton

    0

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

Powered by Zendesk