Naming convention for html.twig of a custom comment field used in views

Created on 14 August 2025, about 4 hours ago

Problem/Motivation

I have custom comments type - entry, to be attached to custom content type - ledger. Entry contains date, title and amount. i want to customise output as 3 columns displayed like table. I have copy-pasted "comment.html.twig" and created "comment--field-entries.html.twig" which works perfectly.

i m using views to control display of this (and all) content type. Thus i added comments field to the view where-ever required. 1st thing i noticed is, it shows comment form below all the comments. to modify this i overridden "field--comment.html.twig" by various naming conventions.. No luck.

Problem is, then "comments" field is used in views, it does not hook this "field--comment.html.twig" or "field--field-entries.html.twig". it should be something like - views-view-field--all-pages--field--field-entries.html.twig. I tried many many combinations for this template. Nothing worked. And twig debug does not provide any suggestions..

Steps to reproduce

create custom comments with some different fields and attach it to any content type. Create a view to show this content "/node/%". Add required fields to view and this custom comments field. See the result. Try to customise this "comments" portion only..

Proposed resolution

naming convention for twig should be more explanatory/inclusive

💬 Support request
Status

Active

Version

10.3 ✹

Component

theme system

Created by

🇮🇳India vinaysamant Kudal, Maharashtra

Live updates comments and jobs are added and updated live.
  • views

    Involves, uses, or integrates with views. In Drupal 8 core, use the “VDC” tag instead.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024