Help Center templating cookbook (Guide Professional and Enterprise)

Have more questions? Submit a request

56 Comments

  • Augusto Silva
    Comment actions Permalink

    Hi Devorah,

    We do support comparison with a setting. However, text field settings will be text strings, which fail the comparison with article ids which are integers.

    You could try to do it in css, by, for example, adding the article.id as a css id to the element you want to show/hide, and then use the setting in css to target that element.

    For example:

    In hbs:
     <article class="article" id='article-{{article.id}}'>

    In css:
    #article-#{$contact_page_id} { ... }

     

    I was wondering, though, if, in your specific use case, you couldn't just add that content directly to the article?

     

    Hope this helps

    2
  • Peter Lynch
    Comment actions Permalink

    FYI - the template formatting is messed up for: "Add sorting for subscription types in the My Activities Following"

     

    1
  • Jacob J Christensen
    Comment actions Permalink

    @Liam

    You can use Dynamic Content to insert html into the Help Center.

    @Eura

    Are you trying to have different article templates depending on the Category they belong to? It's way out of my skill level, but an interesting use case, hope someone here can give a real answer.

    1
  • Trapta
    Comment actions Permalink

    @Vassillios,

    I recommend you to use categories ID instead of name. This way you do not have to worry about language.

    Thanks

    1
  • Trapta
    Comment actions Permalink

    Replace the code in section template with the below code:

    <div class="container-divider"></div>
    <div class="container">
    <nav class="sub-nav">
    {{breadcrumbs}}
    {{search submit=false}}
    </nav>

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

    {{#if section.sections}}
    <ul class="section-list section-list--collapsed">
    {{#each section.sections}}
    <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>
    {{/each}}
    <a tabindex="0" class="see-all-sections-trigger" aria-hidden="true" id="see-all-sections-trigger" title="{{t 'see_all_sections'}}">{{t 'see_all_sections'}}</a>
    </ul>
    {{/if}}


    {{#if section.articles}}
    <ul class="article-list">
    {{#each section.articles}}
    <li class="article-list-item {{#if promoted}} article-promoted{{/if}}">
    {{#if promoted}}
    <span data-title="{{t 'promoted'}}" class="icon-star"></span>
    {{/if}}
    <a href="{{url}}" class="article-list-link">{{title}}</a>
    {{#if internal}}
    <span class="icon-lock" title="{{t 'internal'}}"></span>
    {{/if}}
    </li>
    {{/each}}
    </ul>
    {{else}}
    <i class="section-empty">
    <a href="{{section.url}}">{{t 'empty'}}</a>
    </i>
    {{/if}}

    {{pagination}}

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

    It should fix the alignment issue.

    Thanks

    1
  • James Vreeken
    Comment actions Permalink

    I'm wondering if there is a way to manually show or hide custom html elements based on permissions.

    Thanks!

    1
  • Devorah
    Comment actions Permalink

    Thanks for the responses @Jessie, @Trapta!

    @Augusto - 

    I inverted my example for simplicity sake, but what I actually need to do is show some content on EVERY article page except one:

    {{#isnt article.id settings.contact_page_id}}
      Some content
    {{/is}}

    I'd prefer not to put template-level content into an article and run the risk that content-editors modify or delete it. The class solution is clever but perhaps a bit more brittle than using {{#is}} with the integer because then we've got to hard-code the article id in two places as opposed to one. But a good alternative!

    And thanks for the explanation about the settings text field. That explains why this worked:

    {{#isnt article.id 12345678}}
      Some content
    {{/is}}

    but this didn't:

    {{#isnt article.id settings.article_id}}
      Some content
    {{/is}}

    Any plans to introduce an integer field into the manifest.json file?

    1
  • Augusto Silva
    Comment actions Permalink

    Hi Trapta,

    I think you need to escape the context. Something like:

     {{#is ../settings.visibility 'show'}}

    as described in https://developer.zendesk.com/apps/docs/help-center-templates/introduction#array-iterator-helper

    1
  • Jessie Schutz
    Comment actions Permalink

    Hey Brenden!

    Instant Search is really just a visual/UI type of feature; It's returning the same results you'd get in a regular search; it just surfaces them without needing to click "Search". That being the case, the regular search endpoints should get you the information you need. Unless I'm misunderstanding your question, in which case please let me know!

    0
  • Brett - Community Manager
    Comment actions Permalink

    Hey Efrat,

    Thanks for sharing your feedback!

    In some cases, the above documentation can be useful to show what code does what in your Guide theme. Although this is already implemented by default, the above can show them exactly where to go to remove the functionality from their Help Center if they wish to do so.

    Let me know if you have any questions for me.

    Cheers!

    0
  • Trapta
    Comment actions Permalink

    @Vassillios,

    Glad to hear that. Enjoy! :)

    0
  • Gorka Cardona-Lauridsen
    Comment actions Permalink

    Hi Sebastian

    The snippet shown in the search results are based on the search term the user inputs. If your warning has relevancy in the search it will then show up, provided that the warning is part of the content of the article.

    For us to understand your use case better, could you provide a screenshot of the search results page including the search term with an explanation of what you would like not to be shown in the search results

    0
  • Trapta
    Comment actions Permalink

    Hi @Robert Cabral,

    I think it's because according to the document when you replace the code of section template with the code mentioned in the document, you remove the else condition too which checks if a section has sub-section or not.

    I recommend updating the code with else condition. Try the below code and let me know if it works for you:

    <div class="container-divider"></div>
    <div class="container">
    <nav class="sub-nav">
    {{breadcrumbs}}
    {{search submit=false}}
    </nav>

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

    {{#if section.sections}}
    <ul class="section-list section-list--collapsed">
    {{#each section.sections}}
    <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>
    {{/each}}
    <a tabindex="0" class="see-all-sections-trigger" aria-hidden="true" id="see-all-sections-trigger" title="{{t 'see_all_sections'}}">{{t 'see_all_sections'}}</a>
    </ul>
    {{/if}}


    {{#if section.articles}}
    <ul class="article-list">
    {{#each section.articles}}
    <li class="article-list-item {{#if promoted}} article-promoted{{/if}}">
    {{#if promoted}}
    <span data-title="{{t 'promoted'}}" class="icon-star"></span>
    {{/if}}
    <a href="{{url}}" class="article-list-link">{{title}}</a>
    {{#if internal}}
    <span class="icon-lock" title="{{t 'internal'}}"></span>
    {{/if}}
    </li>
    {{/each}}
    </ul>
    {{else}}
    <i class="section-empty">
    <a href="{{section.url}}">{{t 'empty'}}</a>
    </i>
    {{/if}}

    {{pagination}}

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

    Let me know if this solves your issue.

    Team Diziana

    0
  • Brenden Prazner
    Comment actions Permalink

    Hey.This is awesome! Is there plans to make Instant Search available via the search API?

    0
  • Michael Streeter
    Comment actions Permalink

    I have added {{related_articles}} and ⁠⁠⁠{{recent_activity}} helpers to my article page. One displays a list with a h2 tag and the other displays a list with a h3 tag!

    Also my {{recent_activity}} is showing just a '0' instead of '0 comments' I'd like to change that too.

    Can I get to these templates and alter one of them so the headings are both the same size?

     

    Can I get to these templates and alter one of them so the headings are both the same size and the comment count has extra text?

    Thanks,

    Michael

    0
  • sebastian
    Comment actions Permalink

    Hello Gorka,

    We have many help articles without a warning. The actual case is an article about our telegram support channel. We added a red warning at the top about scammers being active on the channel, imposing admin names or the "send x receive 10*x" scam and so on. So it's a warning especially for that task.

    We are on Enterprise Level.

    We have other warnings in other articles, I guess maybe 2 or 3% of the articles have warnings related to it's content. And unique.

    I saw the search engines on here are more google like. So a snippet taken out of the content of an article. So more seems to be possible. 

    0
  • Trapta
    Comment actions Permalink

    @Augusto, Thanks! I got it working now.

    Trapta

    0
  • Trapta
    Comment actions Permalink

    Hi,

    I am trying to make the below-mentioned code work but for some reason it is not working. Can anyone guide me why it is not working or how to make it work?

    {{#each sections}}
    <li class="blocks-item {{#is settings.visibility 'show'}}with-article{{/is}}">
    // Code goes here
    <li>
    {{/each}}
     
    Thanks
    0
  • Amy Gracer
    Comment actions Permalink

    For the search filter sidebar, I'd like to hide the top level filter... Types, and just display the subfilter on categories because I do not use multiple brands or the community at this time

    Can I do this?

    0
  • Renato Dantas
    Comment actions Permalink

    Hi, 

    I'm starting to use Zendesk HC and I would like to know how to fire an event when the user votes UP or DOWN in the article page.

    I already tried some options, but did not work. 

    Thanks in advance.
    Renato

    0
  • Trapta
    Comment actions Permalink

    @Augusto, Cool Tip!

    +1

    Thanks

    0
  • Amy Gracer
    Comment actions Permalink

    Ryan Gilomen

    Thank you so much for providing the code snippet. I was able to accomplish what I needed to by hiding several sections of the default code, including all of the community helpers and the expanders.

    I actually got it pretty quickly, but didn't realize it because the preview still showed "By Types" even though my help center was showing only By Category as I intended.

    0
  • Ryan Gilomen
    Comment actions Permalink

    Glad you got it figured out! :-)

    0
  • Corrin Duque
    Comment actions Permalink

    I tested this in our Sandbox and the CC appears in two places on the Request page. In addition, the CC is off to the left of the comment box.  Is there a way to get the CC to show up only once?  See screen prints:

    Appears only to left when clicking into a request.

    appears both on Left and above comment once I click into the comment field.

    I tested this on our live Help Center and the appearance and double CC is the same as in our Sandbox as seen in the above screen prints.

    Any way to have the CC show up only once (preferably above the comment instead of to the left as seen on submit a request form)?

    0
  • Kevin Lamenzo
    Comment actions Permalink

    @Eura,

    Currently working on the same problem: multiple categories I'd like to put into different groups of styles. I tried listing out their IDs on the category template using the #is helper, but I can only get this to work for a single ID.

    I also tried nesting #is helpers, building an array of helpers and using #each and #is, and trying to combine #is helpers and parameters with OR and AND statements, but I couldn't get anything to work.

    Zooming out, the idea is to have a one off landing page for a special theme of articles that share a specific style, and then to have another one off category that serves as a news/updates page, also with a separate style.

    Appreciate any advice and/or solutions.

    Thanks.

    0
  • Devorah
    Comment actions Permalink

    I have a similar question to https://support.zendesk.com/hc/en-us/articles/216367358/comments/115002121127.

    I would like to reference a settings variable in an {{is}} statement. 

    {{#is article.id settings.contact_page_id}}
      Show some specialized content only for this article
    {{/is}}

    I need to conditionally show some content only on the contact article, but I'd prefer not to hard-code the article ID directly into the template. The settings variable would be a perfect fit for this, but it doesn't seem to work.

    Is this behavior supported?

    Thank you!

    0
  • Vassilios Lourdas
    Comment actions Permalink

    Brilliant @Trapta!!

     

    Thanks a lot!!! You made my life easier today :)

    0
  • sebastian
    Comment actions Permalink

    I'm searching a way to allow that the search result overview snippets of the articles are defined. That text is taken from the articles first lines. However, if I add a warning or something then the warning appears. Which makes no sense. So I would like to have the actual article still show the warning at the top, but the snippet in search results should skip the warning. Can this be done somehow?

    0
  • Jessie Schutz
    Comment actions Permalink

    Hey Corrin! I'm going to see if I can find somebody to look over this with you.

    0
  • Eura Szuwalski
    Comment actions Permalink

    @jacob - yes, that was the use case. It would be really great if you could use #is tags wth category ids in the article page. 

    @kevin we were even trying do something simple like have a button that only shows up on the article pages within one category! We ended up going another direction, but wish there was more customization that could be done to the article pages. 

    0

Please sign in to leave a comment.

Powered by Zendesk