Hide comment section info if an article has comments disabled

8 Comments

  • Sheldon Grimm
    Comment actions Permalink

    Hi David,

    Great tip, thank you for sharing!

    I've already implemented some of these ideas into our Help Center after reading your post.

    Aside from CSS changes I made to accommodate this, I decided to place the <header class="comment-overview"> within the {{#form 'comment'}}:

     <div class="article-comments" id="article-comments">
    <section class="comments">
    {{#form 'comment'}}
    <header class="comment-overview">
    <h3 class="comment-heading">
    {{t 'comments'}}
    </h3>
    {{/form}}

    In my case, this helps hide the border-top attached to the comment-overview (that I want to keep for when comments are enabled). This may be useful for others with similar border setups for comments, which I believe is default.

    Regards,

    Sheldon

    1
  • David Raboy
    Comment actions Permalink

    Awesome! Thanks for letting all know. The more we add the better.

    0
  • Jessie Schutz
    Comment actions Permalink

    Thanks for sharing this awesome tip, David!

    And Sheldon, thanks for adding your code! :)

    0
  • Jennifer Rowe
    Comment actions Permalink

    David, another great tip from you--thanks! I love this one. 

    0
  • Lenka Prochazkova
    Comment actions Permalink

    Hi David,

    I tried your code and it doesn't seem to work. Is it written for a certain Zendesk theme?

    We are using Humble Squid that we heavily customized. Anything I wrap in the `{{#form}}...{{/form}}` won't show at all. I tested with all different types of articles – such as articles with comment disabled, articles with comments etc. I always get the same result.

    0
  • Jessie Schutz
    Comment actions Permalink

    Hi Lenka!

    This code is specifically for the Copenhagen theme, which I suspect why isn't working for you. I'll check with some of our Community Moderators to see if they have any insight to share on this!

    0
  • Trapta
    Comment actions Permalink

    Hi @Lenka,

    Can you please specify what you are trying to wrap in the {{form}}..{{/form}}? There are possibilities that the component you are adding inside the form is not allowed and that is why it is showing error.

    Please provide little more detail on what you are adding and what is it showing. That will help us in debugging the issue and proving a fix to you.

    Thanks

    Team Diziana

    0
  • Lenka Prochazkova
    Comment actions Permalink

    Thank you for getting back to me, Jessie and Trapa.

    I tried to follow the tutorial and wrapped the form around the Header. I was hopping that the bold headline "Comments" would be removed when comments are not allowed on an article page. :)

    0

Please sign in to leave a comment.

Powered by Zendesk