0

I created a content view in D8, which shows me fields of a content type. Basically it works.

Now I would like to have the total number of comments per listed node displayed as a view field additionally.

There is a field "Count of comments" in the category "Comment Statistics".

When I include this field into the view, all results are hidden, which don't have a comment yet, instead of just display a text like "0 comments" or "No comment yet". The option for the "Behavior if no results" for that field is simply ignored.

I would like to avoid using teaser display mode for my view due to theming reasons, and use fields in the view only, if that is possible.

Does anyone have an idea how to get that solved?

Thanks in advance, Phil

Edit:

Using an author relationship and an user id as contextual filter. But the nodes without comments disappear when comments count field is enabled.

I tried ot also with a new view with no relationships and context filter. Unfortunately the problem still exists.

Here is another issue I found:

https://stackoverflow.com/questions/51416208/node-disapper-with-adding-comment-statistics-comment-count-in-view-drupal8

  • I haven't noticed anything wrong with that field. It must be something in your configuration. Adding a field to Views doesn't filter the results. Field settings only affect that field output, not the entire Views row, it can't hide the entire row. Can you update your question with more information about your filters and comment count configuration? To display some text instead of 0 enable only the Count the number 0 as empty option under No results behavior and enter your text. – prkos Jun 7 at 19:47
  • Thanks prkos for your reply, I edited the question. If you need additional information please let me know. – dercheffe Jun 8 at 18:13
  • Can you post a screenshot of your Views, especially Filters and Contextual filters? It's impossible to guess without any information since this behavior isn't expected and it must be some detail only present in your case. – prkos Jun 8 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.