Selectively hiding Help Center components using Curlybars

Have more questions? Submit a request

18 Comments

  • Ian Maison

    Jake this is great and much appreciated.

    One option that is missing from this is that of hiding an article from the /hc/en-us/categories section. How would this be achieved in terms of an example?

    Thanks.

    0
  • Jake Bantz

    Hi Ian,

    I can provide a quick example in the default Copenhagen theme. To hide an article, the isnt has to go within the article iterator like this:

    That will hide my article 204156349 on the category page, but show all others. Does that help?

    0
  • Ian Maison

    Jake, you are an absolute legend. Well done, it worked and thank you so much.

    0
  • Tess

    This code works for hiding a category.  How do we hide a section?

    0
  • Jake Bantz

    @Ian glad that worked!!

    @Tess do you mean hiding an article on the section page template or are you trying to completely hide a section somewhere?

    0
  • Tess

    Category has 5 sections and I want to hide 1 of them.

    0
  • Jake Bantz

    Hi Tess,

    This is a similar idea to the other solutions, we just need to put the condition around the block which renders each section within the appropriate #each statement. Here is the solution to hide section 200952599 in my account (note the closing isnt right before the else which dictates the behavior for an empty category):

    Hope this is useful for you!

    0
  • Jacob

    Hi Jake - 

    This has all been so helpful. Thanks! I have very little coding experience, but I've been able to follow along to make a few small changes. I'm wondering if you could help me find a way to ignore our article template for just one of our articles. Basically, I've redirected our 'Video Tutorials' category button on our homepage to lead straight to the first article in that category. Now, for a better user experience, I would like this Video Tutorial article page to ignore most of the formatting that comes with the rest of our templates. Mainly, I'd like to remove the side bar with other article suggestions so I can embed a larger video player in the center of the page, and eventually a scrolling menu of additional videos below.

    I understand that this is a large undertaking, but if you could guide me in the right direction to avoiding the template for a specific article, that'd be awesome! Thanks!

    0
  • Jake Bantz

    Hi Jacob!

    I'm glad you were able to use this!

    This is pretty achievable, especially if it's only for one article. We would use an #is condition to check if the currently viewed article is the one where you want the special behavior. Then below the 'else' we will have the fallback behavior for all other articles:

    {{#is article.id 223196988}}
    Here is where you would put the special code for your video player.
    {{else}}

    The 'fallback' or existing article code would stay here.

    {{/is}}

    If there is a certain part of the template you want to use for the special video article and the rest of your articles, you would just leave that outside of this conditional statement.

    Hope that helps!

    0
  • Jacob

    Thanks, Jake! It was the 'article.id' that was tripping me up. My next challenge is to figure out how to incorporate this 'slick' carousel code I found!

    0
  • Chris Stock

    Is there a way to the inverse of hiding multiple categories and only show multiple categories? Say I have 20 categories and I only want to display 3, I'd rather specify the three I want to display rather than add 17 isnt blocks for ones I don't want to display.

    Thanks!

    0
  • Trapta

    Hi @Chris,

    You can use {{#is}} instead of {{#isnt}} for the three categories you want to list.

    Team Diziana

    0
  • Chris Stock

    Thanks @Trapta. You can use {{#is}} but you have to replicate the block of html you want to display for each category.

    e.g.

    {{#is id 123}}
    <h1>{{name}}</h1>
    {{/#is}}
    {{#is id 456}}
    <h1>{{name}}</h1>
    {{/#is}}
    {{#is id 789}}
    <h1>{{name}}</h1>
    {{/#is}}

    I'd like to be able to do something like:

    {{#is id 123 or 456 or 789}}
    <h1>{{name}}</h1>
    {{/#is}}
    0
  • Michelle Kinsey Bruns

    Hi there,

    Is there a way I can write logic into footer.hbs to selectively hide content only if the user is viewing the new request form? I have a global link to submit a new request that I'd like to hide if that's what the user is already in the middle of doing. Thanks.

    0
  • Jake Bantz

    Hi Michelle,

    There isn't a way to implement a conditional statement to check the current page, but you could possibly add a Javascript snippet in a <script> block only on the new request template which hides the link you're presenting in the footer. It's not a perfect solution, but may help you accomplish the behavior which you seek.

    0
  • Ole Lindtveit

    Hi, 

    I would like to hide meta data for articles - making sure author and edit date is hidden. I have succeeded in the article-view, but when articles are shown in search results, the meta data is shown. 

    Can you please help me in the right direction for hiding this info in search results as well? 

    Thank you!

    0
  • Vladan Jovic

    Hey Ole, all you need is to edit the search page template and remove these highlighted lines of the code:

    Let us know if this doesn't help! 

    0
  • Ole Lindtveit

    Sweet, it helped a lot! Thanks! 

    1

Please sign in to leave a comment.

Powered by Zendesk