0

my folder structure looks something like this:

📂 themes
└─ 📂 foo
   ├─ 📂 bar
   │  ├─ 📂 templates
   │  │  └─ 📄 node.html.twig
   │  └─ 📄 bar.info.yml
   ├─ 📂 templates
   │  └─ 📄 page.html.twig
   ├─ 📄 foo.info.yml
   └─ 📄 foo.libraries.yml

now I run a multisite. one site is using the foo theme and the other uses bar.

The site using the foo theme also invokes the template /theme/foo/var/templates/node.html.twig

  1. Why is that so?
  2. I thought the foo theme only invokes templates inside its own templates folder? I expected this to be the point of the templates folder. Is that assumption wrong?
  3. can I prevent this behavior without moving the subtheme somewhere else?
1

Themes are not allowed to be placed inside one another, as oppose to modules. Even though it works, there are undesired side effects.

0

This directory structure is shows one single theme called foo. The sub-directory bar has no meaning at all for Drupal, it is below /themes/fooand as such part of foo.

Your node file has to go into /themes/bar/templates/OPTIONAL/SUBDIR/DOES/NOT/MATTER/node.html.twig

Every theme, even subthemes, has to go in it's own /theme-directory. Please red read the docs for sub-themes.

  • How and where do the docs answer the question? – loominade Oct 18 at 9:02
  • The very first words on the sub-themes docs page are "Sub-themes are just like any other theme". As your main theme foo already has a correct file and folder structure, it seems you already know how to create a theme. Do the same with the sub-theme, but add the basethemekey in the YAML – Hudri Oct 18 at 9:16

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.