Article

How to enable theme suggestions in Drupal 8

twig debugging.png

OK, I'm not a programmer, never was or said I am. But I can play around and act like one. It's harder to comprehend things that are obvious for dedicated coders, but at the end, what matters is the final result. 

Cut the long story short.

I wanted to modify a twig template to reformat the output of a view built with Paragraphs fields. But I didn't have a clue on where and how to do start doing that. I found all sorts of pieces of code to put into theme.php, but nobody said it's a Drupal 8 feature to debug twig templates.

You just need to rename default.services.yml (in sites/default) into services.yml and set debug: true. Simple as that. Save, drush cr and continue learning!

Oh, one more thing. If you have such tool that optimizes the output of your HTML, just remember to disable HTML comments removal.

I have pagespeed module compiled with nginx and I had to comment out a line in pagespeed.conf to enable comment in page source.

That's all.

Rate this article: 

Average: 1 (1 vote)

Category: 

 

Portfolio

Samples of work done for me or my customers, for free or not, like websites, repairs, photography etc.
View all my recent work

 

Tutorials

I'm giving away some knowledge in my areas of expertise. Did you like something here? Share it please!
View all tutorials

 

Snippets

Useful Linux commands or other code snippets I often use.
View my useful shortcuts

 

Resources

Few bookmarks I find useful. Do you want website here? Give me a good reason and I can help you.
View my favourite web resources

About me

Hi there! My name is Marius Cârneală.

About me?

Loving husband, dad of one two three, drone pilot, web designer and administrator, SEO specialist, IT support guy, electronic hobbyist and content writer. This list is open.