0

In D8, I'm just wanting the comments that follow the content on a node page to appear in a normal fashion, but the comment list that appears displays a trimmed comment.

The markup itself contains trimmed text:

<div class="comment-text">
    <div class="comment-arrow"></div>
      <h3><a href="/comment/711#comment-711" class="permalink" rel="bookmark" hreflang="en">Please make results of this</a></h3>
        <div class="content">
            <div></div>
        </div>
     </div>
</div>

and I note that the comment is contained in a h3 tag and the content tag is empty.

I've checked the comments type display settings for article, the content display settings for the comments, which is set to show a comment list (no other options), and see nothing set to trim.

enter image description here

Here is some additional information that might be useful:

Comment bodies ARE displayed IF the comment is a reply to another comment. If the comment is NOT a reply to another comment, the meta shows (author, date, etc.) but no body, even though the comments do have body text in comment__comment_body.

The twig entry that is used in either case seems kosher to me:

<div class="comment-text">
  <div class="comment-arrow"></div>
  {#{% if title %}#}
    {#{{ title_prefix }}#}
    {#<h3{{ title_attributes }}>{{ title }}</h3>#}
    {#{{ title_suffix }}#}
  {#{% endif %}#}
  <div {{ content_attributes.addClass('content') }}>
    {{ content.comment_body }}
  </div>
</div>
2
  • Two questions. Have you overridden the Comment template? Does this apply to all comments?
    – johndevman
    Commented May 20, 2017 at 21:24
  • I've not overridden the comment template. I'm using Nexus, but the same thing happens with Bartik. It happens with all comments when anonymous, and all of the same when authenticated, but as admin, a couple unapproved comment replies show indented below the comment, and it does not happen with them. Each truncated comment is a rendered as a link that leads back to the same page.
    – JAyenGreen
    Commented May 20, 2017 at 21:32

1 Answer 1

0

Have you looked if the format is not set to "trimmed" on the comment display page (/admin/structure/comment/manage/comment/display) ?

6
  • It is set to 'default,' as opposed to 'trimmed.' That does beg the question of from where the meaning of 'default' is determined.
    – JAyenGreen
    Commented May 22, 2017 at 13:52
  • My best guess is that "trimmed" and "default" settings are created within the comment module which is part of drupal core. Maybe you could try creating a new view mode (/admin/structure/display-modes/view/add/node), set it up on your article display page and see if you have the same problem in that mode (you can change the view used when you preview a node). Commented May 22, 2017 at 14:56
  • That doesn't seem to be it. I was going to create a Full (comment.full) mode, but there already is one. The comment type display settings only offers default and trimmed, but the comment field on the content type settings is set to default and has full available. When I select that and clear cache, there is no difference.
    – JAyenGreen
    Commented May 22, 2017 at 20:42
  • What's more, the markup shows each trimmed comment as a h3 link, which I suspect is meant to hold the comment subject. There is a <content> tag indented below it, which is empty in each comment.
    – JAyenGreen
    Commented May 22, 2017 at 20:46
  • I take that last comment back. I just checked the db and the subjects are trimmed body, which in itself is interesting because no one explicitly entered a subject, but in any event, the comment body entries are complete, so it appears that it's just that {{content}} in the twig file is not being populated at all.
    – JAyenGreen
    Commented May 22, 2017 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.