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

Return to top
Have more questions? Submit a request

43 Comments

  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • Brett Bowser
    Zendesk Community Team

    Hey Hugo,

    Great question!

    You'll want take a look at our developer docs for a list of conditional helpers available.

    I hope this helps!

    -1
  • Hugo Baeta

    Hey Brett Bowser

    I should have clarified, I have been to that page and I'm aware of the conditionals, but there no list of Conditions...

    {{#if condition}}

    The only one listed in the article you linked in is the example

    {{#if article.internal}}

    article.internal is a condition. What other conditions can I use?

    Thanks.

    0
  • Charles Nadeau
    Zendesk Documentation Team

    Just to step in here quickly. A condition is anything that resolves to true or false. You basically create the condition you want to meet. Example:

    {{#if name == 'Foo'}}
    -1
  • Hugo Baeta

    Thanks Charles Nadeau

    That's great, but I'm not sure you understood my original question: I want to ask if I'm on the homepage... comething like:

    {{#if template.home}}

    Or something like that. A good example, for me, is the WordPress conditionals documentation, that lists the conditions, like `is_home()` https://developer.wordpress.org/themes/basics/conditional-tags/

    On Zendesk themes, I've seen in Copenhagen or in many forum entries some conditionals like `if id xxx` or `if article.internal`. For example, I'm using the if ID to give me some classes to add specific styles to certain categories. But all of this has been a frustrating wackamole game, if I don't know what conditions I can ask for. :(

    I appreciate the help, I hope I'm making my issue clearer here :)
    Thanks

    0
  • Augusto Silva
    Zendesk team member

    Hi Hugo Baeta,

    All the properties that are available in each page can be used together with an if statement.

    You'll probably be more interested in looking at the ones that return a boolean value.

    For example, if you look at the docs for the home page, you can see there's a help_center object available. If you follow the link to its properties, you'll see this object has the boolean property community_enabled. So, you can do this:

    {{#if help_center.community_enabled}}...{{/if}}

     

    Regarding your specific question about a template object that is currently not available. If you need to have a different header/footer for some of the pages, we recommend you leave those templates empty and add the code to the main template files.

     

    Hope this helps

    0

Please sign in to leave a comment.

Powered by Zendesk