As things stand now we have a hack in our core comment-wrapper template specifically for forum:

<section id="comments" <?php print $attributes; ?>>
  <?php if ($content['comments'] && $node->type != 'forum'): ?>
    <?php print render($title_prefix); ?>
    <h2 class="title"><?php print t('Comments'); ?></h2>
    <?php print render($title_suffix); ?>
  <?php endif; ?>

  <?php print render($content['comments']); ?>

  <?php if ($content['comment_form']): ?>
    <h2 class="title comment-form"><?php print t('Add new comment'); ?></h2>
    <?php print render($content['comment_form']); ?>
  <?php endif; ?>
</section>

It might make more sense for forum module to provide it's own version of this template file, one that inherits from comment-wrapper.twig and removes the title.

Suggested change:

comment-wrapper.html.twig

<section id="comments"{{ attributes }}>
  {% codeblock %}
  {% if content.comments %}
    {{ title_prefix }}
    <h2 class="title">{{ 'Comments'|t }}</h2>
    {{ title_suffix }}
  {% endif %}
  {% endcodeblock %}

  {{ content.comments }}

  {% if (content.comment_form %}
    <h2 class="title comment-form">{{ 'Add new comment'|t }}</h2>
    {{ content.comment_form }}
  {% endif %}
</section>

comment-wrapper--forum.html.twig

  {% extends 'comment-wrapper.html.twig' %}
  {% codeblock %}
  {% endcodeblock %}

see #1783184: [meta] Use Twig template inheritance

Comments

jenlampton’s picture

Project: » Drupal core
Issue summary: View changes

Updated issue summary.

c4rl’s picture

Version: » 8.x-dev
Component: Twig templates » theme system
Status: Active » Postponed

Moving to core queue and postponing due to #1783184-5: [meta] Use Twig template inheritance

c4rl’s picture

Issue summary: View changes

h2

mgifford’s picture

Because #1783184: [meta] Use Twig template inheritance is "works as designed" should this issue be closed now?

joelpittet’s picture

Version: 8.0.x-dev » 8.1.x-dev
Status: Postponed » Closed (works as designed)

This template moved to field--comment.html.twig and we can have template suggestions to override this or add a twig block if needed.

If you disagree please add notes to the issue summary to why this would help core. A screenshot of before/after would help sell the point I bet, not sure why removing the title is necessary for forums.

Triaging