I know there are similar questions to this that have been asked but none of the solutions are working for me and I've been at this all day so I thought I'd give this a try.

I've created a sub-theme of Bartik for Drupal 9. I've copied the page.html.twig and I'm trying to include a templates/includes/footer.html.twig and nothing I have tried has worked.

  1. I installed the components module and updated DB

  2. Declared the following in subbartik.info.yml:

        includes: includes
  3. Input the following into page.html.twig

    {% include '@includes/footer.html.twig' %}

Cleared cache with drush, and I get error:

    Twig\Error\LoaderError: Template "@includes/footer.html.twig" is not defined in "sites/default/themes/custom/subbartik/templates/page.html.twig" at line 125. in Twig\Loader\ChainLoader->getCacheKey()
  1. I've tried a relative path from web folder root

    {% include 'sites/default/themes/custom/subbartik/templates/includes/footer.html.twig' %}

Same error:

    Twig\Error\LoaderError: Template "sites/default/themes/custom/subbartik/templates/includes/footer.html.twig" is not defined in "sites/default/themes/custom/subbartik/templates/page.html.twig"
  1. I tried the old:

    {% include '@subbartik/includes/footer.html.twig' %}

Same error:

    Twig\Error\LoaderError: Template "@subbartik/includes/footer.html.twig" is not defined in "sites/default/themes/custom/subbartik/templates/page.html.twig"

Any suggestions would be appreciated. Thanks!


File structure (figured it would just be easier to take a screen shot):

file system of drupal project starting at root, then web, sites, default, themes, custom, subbartik

  • 3
    sites/default/themes? in drupal 9? where have you put your theme? it is not drupal 7 any more Jan 11, 2022 at 5:50
  • This is a local dev environment. It's inside the web/ directory.
    – tWoolsey
    Jan 11, 2022 at 18:02
  • Can you provide your file structure? Jan 12, 2022 at 3:54
  • Yes, I updated the post with a screen shot of my file structure. Thanks.
    – tWoolsey
    Jan 12, 2022 at 18:47
  • Put it in web/themes/custom
    – leymannx
    Jan 12, 2022 at 19:16

1 Answer 1


There was a caching problem that had nothing to do with the template itself. Not sure exactly what happened but I turned off MAMP, did something else for awhile, came back and it was working fine. Thanks!

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.