For some reason I don't see the views theme suggestions in my twig debug information? What do I miss?

  • In my development.services.yml in set debug to true.
  • I do see debug information and theme suggestions from other page items.
  • I do see views debug info but not the theme suggestions. See image below:

enter image description here

On other website I see suggestions like this:

enter image description here


This is a bug in Drupal 8 core, currently being worked on for version 8.8

If you need the functionality now, you have two options:

  1. Try the patches from comment #22 (or more recent) on Issue #2923634 and the patches on Issue #2752443. Read the comment thread on #2923634 to get a full understanding of what's going on here.

  2. Or use the well-vetted patch from comment #139 on Issue #2118743 which has been postponed in favor of option 1 above.

I'm using the patch from option 2 (#2118743) successfully. Please note that this does go against the standard core contributor recommendations. But the reason is because #2118743 has a single, well-vetted and working patch for something that is only enabled / used during development, and instead of needing to test out various combinations of two separate patches that are still under development. Once the better solution (#2923634 and #2752443) get fixed in core, #2118743 should be obviated and no longer required.

| improve this answer | |

You can see that you get views-view-fields.html.twig for example, the naming conventions is then:

  • views-view-fields--foobar--page.html.twig
  • views-view-fields--page.html.twig
  • views-view-fields--foobar.html.twig
  • views-view-fields.html.twig

From: https://api.drupal.org/api/drupal/core%21modules%21views%21views.theme.inc/group/views_templates/8.2.x

In case you have a custom news feed it would look like this:


where news-feed is the machine name of the view.

You can copy the default templates in the stable theme in core to have something to start building from.

| improve this answer | |
  • Yes, that I know but I'm used to get more suggestions, see edited question for an extra image of what this looks like. – Joost Nov 9 '17 at 10:14
  • Interesting, I see now. Well I did a small test and when I removed my custom template, the suggestions also got removed and when I put the template back I got the suggestions back. Not sure if this is a bug in Drupal but it might explain your problem. – Simon Quick Nov 9 '17 at 10:19
  • Hhhmm, strange, I'm working with a custom template. Any suggestions how to fix this? – Joost Nov 9 '17 at 11:04
  • Do you get the custom template to show? If not, something with the naming is not corresponding to the template name convention. If you get it to show I don't know why you don't get name suggestions. – Simon Quick Nov 9 '17 at 11:19
  • Yes, the custom theme is working great. – Joost Nov 10 '17 at 6:22

Your Answer

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

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