Multiple Conditions in an #is statement | Community
Skip to main content

Multiple Conditions in an #is statement

  • June 20, 2017
  • 2 replies
  • 0 views

I apologize if this is already answered, but it appears at the time I'm writing this, there is no search functionality in ZenDesk's Help Center. I've tried in 3 browsers across different devices. I'm assuming it's just temporarily broken. So here's my question:

I'm trying to omit the Author and avatar from most articles in our Help Center, but I do want them to show for any articles in my News & Updates Category.

I've found that I can access section.id from an article, but I don't seem to be able to access category.id. I've tried it on its own, and I've also tried. section.category.id, but neither work.

So I figured that doesn't exist and instead I need to evaluate the section IDs, but I need to check for two of them. If the section ID is x OR y then show the author. But I can't figure out how to use an OR expression within {{#is section.id 12345 or 56789}}

To summarize, my two questions:

  1. Can I get to the category id from within an article?
  2. Can I use an OR property within an #is evaluation?
This topic has been closed for replies.

2 replies

Nicole17
  • June 20, 2017

Hey Aaron - 

Apologies for the confusion; some updates were being rolled out last night which temporarily broke the search functionality. Everything is up and running again now. 

I'm looking into your question, but hopefully someone from the community can jump in in the meantime! 


Trapta
  • July 31, 2017

Hi @Aaron Stewart,

In response to your first question,

  - You cannot get a category id on article template using Zendesks' HC components but, you can get it using some Javascript. Please refer to Get category_id from section page. You can use the piece of code written by Vladan Jovic on article template to get the category id.

In response to your second question,

  - You cannot use OR property within an #is evaluation, you can nest #is statement within the else to allow you to check multiple sections but, in this case, you have to repeat code for both the sections. Something like this -

{{#is section.id 200893084}}
  {{! show the author}}
{{else}}
  {{#is section.id 200117648}}
    {{! show the author}}
  {{/is}}
{{/is}}

 

Cheers

Team Diziana