我知道有人问过类似的问题,但是没有一个解决方案对我有效,我一整天都在这样做,所以我想我应该试一试。
我为Drupal 9创建了Bartik的一个子主题,我复制了page.html.twig,并且我试图包含一个模板/ include /footer.html.twig,而我尝试过的任何东西都没有起作用。
使用drush清除缓存,我得到错误:
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()同样的错误:
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"同样的错误:
Twig\Error\LoaderError: Template "@subbartik/includes/footer.html.twig" is not defined in "sites/default/themes/custom/subbartik/templates/page.html.twig"如有任何建议,将不胜感激。谢谢!
文件结构(认为使用屏幕截图会更容易):

发布于 2022-01-13 00:25:30
存在一个与模板本身无关的缓存问题。不知道到底发生了什么,但我关掉了MAMP,做了一段时间其他的事情,回来了,一切都很好。谢谢!
https://drupal.stackexchange.com/questions/309101
复制相似问题