Hiding article comments with curly bars

Have more questions? Submit a request

13 Comments

  • Mandeep Singh

    This is super helpful! Thanks Ray

    0
  • Tim Finney

    Hello,

    Is it possible to have comments be internal or moderated? Or are comments simply 'on' or 'off'?

     

    Thanks,

    Tim

    1
  • Jessie - Community Manager

    Hey Tim! I just answered your question over here: Disabling Social Media and Comment options in Help Centre

    0
  • Jacob J Christensen

    Thanks Ray, just what I needed.

    1
  • Danielle Dalton

    Thank you for this post! Since the Follow button at the top only relates to comments, does anyone know how to remove the Follow button? It's irrelevant if comments don't exist. Thank you!

    0
  • Jacob J Christensen

    Hi Danielle,

    You're right about the follow button on articles is only for comments - but it is also available for Sections, where it notifies followers of any new articles appearing in said Section (or articles being moved to this section).

    So while it will make sense to remove the button on the article template you may want to consider leaving it on the Section template. 

    In any case it is called {{subscribe}} in the markup, you can either delete it or replace it with {{!-- {{subscribe}} --}} , so you can easily change it at a later time.

    0
  • John Yu

    Image links are broken, please fix it when possible. Thanks.

    0
  • Jake Bantz

    Hi John,

    Thanks for the heads up! It looks like they were pointing at an internal location. I have fixed the images so they are available to all.

    0
  • Bridget de Gier

    I'd love to know is it possible to hide the comments on just certain categories?  We have our guide set up to provide articles on how to use our software but some categories are also configured to just provide notifications.  We'd like our users to be able to add comments to the user articles but not on the notifications.  Is this possible?  Can the comments be restricted to certain categories or sections only?

    0
  • Trapta

    Hi @Bridget,

    There are two ways of doing it, you can use JavaScript and write a function to hide it for certain categories or you can mark all the article from article content editor to make an article 'Open for comments' or not.

    Team Diziana

    0
  • Jake Bantz

    Thanks Trapta!

    Another solution would be to hide the comments by using Curlybars. Unfortunately we cannot hide the comment section by category, but we can hide it by section. Where Ray has used the {{!-- and --}} above, you could instead insert something like this around those blocks of code:

    {{#isnt section.id 1234}}
    {{#isnt section.id 3456}}

    Existing code here...

    {{/isnt}}
    {{/isnt}}

    Using the isnt helper will only show the comment blocks if the section is not one of the sections highlighted above. If you are interested, I go into a bit more detail about this sort of scenario in this article: https://support.zendesk.com/hc/en-us/articles/115011134947-Selectively-hiding-Help-Center-components-using-Curlybars

    Hope that helps!

    0
  • Fabien RIC

    The solution I found to hide the comments section is to change the article_page.hbs file like this.

     

    • If you want to enable comments depending on the article:

    {{!-- Only show the comments section if the article is open for comments --}}
    {{#unless article.comments_disabled}}
    <div class="article-comments" id="article-comments">

    ...

    </div> 

    {{/unless}}

     

    • If you want to completely disable comments, just comment the whole section as Ray described.
    0
  • Jessie - Community Manager

    Thanks for sharing your solution, Fabien!

    0

Please sign in to leave a comment.

Powered by Zendesk