I am using Drupal 8 from github:drupal/drupal@a9ac0fbf17, but having problems creating custom template, using Twig template engine.

Here is template file structure:

├── README.txt
├── screenshot.png
├── templates
│   └── html.html.twig
└── custom.info.yml

html.html.twig file is not being loaded. I have tried to change ownership/permission of the files, but it didn't help. I turned on twig_debug and getting:

<!-- THEME DEBUG -->
<!-- CALL: _theme('html') -->
   * html--front.html.twig
   * html--node.html.twig
   x html.html.twig
<!-- BEGIN OUTPUT from 'core/modules/system/templates/html.html.twig' -->

which, I assume means it is loading default template from core/modules/system/templates/.

Here is the content of my html.html.twig:

 * @file
 * basic html structure of a single Drupal page.

 <!doctype html>
 <html lang="en">
 <head {{ html_attributes }}>
   <title>{{ head_title }}</title>
   {{ page.head }}
   {{ page.styles }}
   {{ page.scripts }}
<body {{ attributes }}>
    {{ page_top }}
    {{ page.content }}
    {{ page_bottom }}
    {{ page.scripts('footer') }}

What might I be missing? let me know if you need more info.

  • Welcome to Drupal Answers! Are you using the template in a theme or a module?
    – apaderno
    Commented Jul 12, 2014 at 12:19
  • I'm using it in a theme. I got it working just now. I copied bartik theme and made my modifications on it, but the structure and contents of files remaining the same. I am still not sure why it didn't work, probably cache issue. I would answer my own question, if I knew the reason, but if I find out, I'll post answer here.
    – Azamat
    Commented Jul 12, 2014 at 12:39
  • Do you try clear cache (drush cache-rebuild or admin/config/development/performance).
    – rpayanm
    Commented Feb 5, 2015 at 19:05
  • I too am getting like this : <!-- FILE NAME SUGGESTIONS: * html--front.html.twig * html--.html.twig x html.html.twig --> , I have added twig files in my_module/templates folder. I have cleared cache, but my twig file is not getting loaded. Please help!
    – neha
    Commented Sep 24, 2016 at 15:59

2 Answers 2


To disable cache for development(tiwg + Drupal cache) :

first copy and rename the sites/example.settings.local.php to be sites/default/settings.local.php

then open settings.php file in sites/default and uncomment these lines:

# if (file_exists(__DIR__ . '/settings.local.php')) {
#   include __DIR__ . '/settings.local.php';
# }

Now open settings.local.php and change the below lines to "TRUE".

$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;

and uncomment all these to Disable the render cache and Disable Dynamic Page Cache

# $settings['cache']['bins']['render'] = 'cache.backend.null';
# $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

for twig cache open "development.services.yml" and update the below parameters.

    debug : true
    auto_reload: true
    cache: false

If your template does not load usually is because is been cache. Its recommend to disable the caching twig in Drupal 8 with developing.

The easier way to "Disable Drupal 8 caching during development" is using DrupalConsole.

drupal site:mode dev

Source - Debugging compiled Twig templates

After you disable your cache you can use the cache:rebuild Drupal Console command to clear the cache.

drupal cache:rebuild

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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