Using the Help Center templating language (Guide Professional and Enterprise)

Return to top
Have more questions? Submit a request

38 Comments

  • Trapta
    Community Moderator

    Hi @Joakim Eide,

    You can use {{@index}} to get nth-element from an array. Please look at the below code to get an idea:

    {{#each categories}}
    {{#is @index 1}}
      // Your code goes here
    {{/is}}
    {{/each}}

    Let me know if this is what you are looking for.

    Team Diziana

    2
  • Zach Schrock

    Hi there, I'm trying to see if it is possible to pull Category Titles into Section Pages and other similar functions.

    I also need some sort of way to show different images depending on the Category one is in.

    {{#if CATEGORY 1}}
      CATEGORY 1 ICON
      CATEGORY 1 TITLE
    {{else}}
      CATEGORY 2 ICON
      CATEGORY 2 TITLE
    {{/if}}

    Is this possible at all?

    Or even something like

    {{#if CATEGORY 1}}
      CATEGORY 1 ICON
      CATEGORY 1 TITLE
    {{/if}}

    {{#if CATEGORY 2}}
      CATEGORY 2 ICON
      CATEGORY 2 TITLE
    {{/if}}

    1
  • Will Strohl

    Thanks, Charles.  This is exactly what I'm looking for.

    0
  • Chris

    quick question... is it possible to use multiple #is statements with an else statement? I tried the following, but it throws a syntax error. 

    {{#is name 'Get Verified'}}<span class="section-name"><i class="fa fa-shield" aria-hidden="true"></i>{{name}}</span>
    {{#is name 'Member Login'}}<span class="section-name"><i class="fa fa-sign-in" aria-hidden="true"></i>{{name}}</span>
    {{#is name 'Orders & Shipping'}}<span class="section-name"><i class="fa fa-truck" aria-hidden="true"></i>{{name}}</span>
    {{#is name 'Returns & Exchanges'}}<span class="section-name"><i class="fa fa-reply-all" aria-hidden="true"></i>{{name}}</span>
    {{#is name 'Tickets & Travel'}}<span class="section-name"><i class="fa fa-ticket" aria-hidden="true"></i>{{name}}</span>
    {{#is name 'General Help'}}<span class="section-name"><i class="fa fa-handshake-o" aria-hidden="true"></i>{{name}}</span>
    {{#is name 'Customer Support'}}<span class="section-name"><i class="fa fa-info-circle" aria-hidden="true"></i>{{name}}</span>
    {{else}}<span class="section-name">{{name}}</span>{{/is}}

    Is there a better way to tackle this?

    0
  • Jehan

    Thanks Rebecca. I already did it through JavaScript.

    0
  • Chris

    Hi Dan, 

    I got it to work! The final formatting looks like this:

    {{#is section.name 'Section 1'}}

    HTML 1

    {{else}}

    {{#is section.name 'Section 2'}}

    HTML 2

    {{else}}

    {{#is section.name 'Section 3'}}

    HTML 3

    {{else}}

    Fallback HTML

    {{/is}}

    {{/is}}

    {/is}}
    0
  • Jehan

    @Kris Scuteri I don't think there will be any help in Guide templating language. You will need to do it through JavaScript.

    0
  • Giacomo Paita

    Hi, 

    i cant' find in the documentation the list of all avalaible value for the "t" keyword, that are used for example in this snippet for the ERROR page :

    {{t 'oops'}}

    Thanks in advance!

    Giacomo

     

    0
  • Chris Cardone

    Would it be possible to hide/show content on the basis of user tags or user segment?

     

    {{#if user.tag 'agency'}}

    <div>Agency Specific Content</div>

    {{/if}}

    0
  • Charles Nadeau
    Zendesk Documentation Team

    You'll need to set up some kind of  #if condition:

    {{#if condition}}
      This is rendered if the condition is true.
    {{else}}
      This is rendered if the condition is false.
    {{/if}}
    0
  • Netrebenko

    Hi, people!

    Please tell, is it possible to use a helper which is not available in some particular template? For example, I'd like to display the user name in the Header: 'Hello, {{user.name}}, nice to meet you!"

    0
  • David Sanchez

    How can I custom a helper?, for example I want to get some elements from an array, if I have 10 in total just get 3 for example, I want to do that with each helper

    0
  • Hugo Baeta

    Where can I find a list of conditionals?

    I was hoping to be able to do something like:

    ```

    {{#if template.homepage}}
        THIS IS THE HOME PAGE
    {{/if}}

    ```

    0
  • Joakim Eide

    Thanks a lot Trapta! I feel like I somewhere read that Curlybars is based on Handlebars and does not have all the functionality. So I felt it natural to assume that the functionality describe on Zendesks template language pages reflects all available functions.

    I'll check handlebars documentation from now on before I ask questions! :)

    0
  • Erika Camille Sundian
    Zendesk Community Team

    Hello Chris Cardone,

    You can specify tags in user segments. User segment is the way to hide/show content in your Help Center.
     
    Let me know if you have any questions! :)
    0
  • intakhab ali

    hi, i am trying to create customize the community page I want a list of topic and list of post in the same page, is it possible

    0
  • Dan Ross
    Community Moderator

    Hey Chris,

     

    Maybe with chained else conditionals? I'm not in a position to test this right now, but I think it could work. Let me know!

     

    {{#is section.name 'Section 1'}}

    HTML 1

    {{/is}}

    {{else}}

    {{#is section.name 'Section 2'}}

    HTML 2

    {{/is}}

    {{else}}

    {{#is section.name 'Section 3'}}

    HTML 3

    {{/is}}

    {{else}}

    Fallback HTML

    Good luck!

     

    0
  • Jehan

    Can I search for a specific string inside a an Article title OR attachment name Or any string? Let suppose I have two type of attachments with an article. One is a PDF and other is an Image. I want to know if there is any Helpers that can differentiate between the two. 

    {{#contains article.title "pdf"}}

    This is PDF document 

    {{/contains}}

    0
  • Jessie Schutz
    Zendesk team member

    Hi Jehan! Let me see if I can find someone to answer this for you!

    0
  • Will Strohl

    Where can I find a list of the various handlebar tokens that Zendesk provides in each view?  I've looked and looked and can't find any.  All I get are very specific, beginner examples of editing themes.

    0
  • Jessie Schutz
    Zendesk team member

    Hi Will!

    You can find our complete Curlybars documentation here:

    Please let us know if you have any other questions!

    0
  • Devan - Community Manager
    Zendesk Community Team

    Hello Intakhab,

    This is possible through the use of custom code. I've gone ahead and linked an article below that describes how to begin this process in further detail.

    Customizing your Help Center

    Best regards!

    0
  • Nicole S. - Community Manager
    Zendesk Community Team

    Hi David,

    Can you tell us more about what it is you're trying to accomplish so that we can better assist you? 

    0
  • Nicole S. - Community Manager
    Zendesk Community Team

    Hey Mario - 

    The templating engine should give you access to the HTML code; there's not a separate mode. 

    0
  • Trapta
    Community Moderator

    Hi @Zach,

    The cases you have mentioned is not possible in Zendesk currently. You can use JS to extract category from breadcrumbs and then add a function to show and hide banner.

    Thanks

    Team Diziana

    0
  • Joakim Eide

    I've been looking all over this place for a way to extract the first or nth- element from an array in this Curlybars langauge, can anyone help me with that? EVERY example in this place uses the #each, as if it's impossible to get the first article when you have the data available?

    0
  • Will Strohl

    Thanks, Jessie.  I found that on multiple occasions, but I don't see where it defines which properties are available to which views, and which properties those properties have.

    0
  • Zach Schrock

    So..... no one cares to help with my question above?

    0
  • Trapta
    Community Moderator

    Hi @Giacomo,

    Here it is: https://developer.zendesk.com/apps/docs/help-center-templates/helpers#available-keys

    Team Diziana

    0
  • Charles Nadeau
    Zendesk Documentation Team

    Hi Will,

    Click any object links in the "Available properties" tables in the template-specific docs. For example, in the Section page doc, clicking the article object link for the promoted_article property will take you to the object's reference doc.

    Is this what you're looking for?

     

    0

Please sign in to leave a comment.

Powered by Zendesk