hi guys. i have a problem in developing a theme of my site. in the templates /modular/abc.html.twig file I want to use {% include ‘/user/pages/02.abc/_abc/abc.html.twig’ %} to returns the rendered content of .html.twig file in /user/pages/02.abc/_abc/. but it comes up with an error saying “An exception has been thrown during the rendering of a template (“Template “/user/pages/02.abc/_abc/abc.html.twig” is not defined.”) in “modular.html.twig” at line 26.” how could i solve this problem.
The page you are on already has been rendered by the time you get to the theme, then it’s just a matter of:
{{ content }}
If you want to display the content of another modular page it’s:
{{ page.find(/abc/_abc).content }}
This will render the content (ie, the page with markdown/twig processed). It’s wont actually render the Twig which the page would normally use.
If you wanted to render Twig + content you could do something like:
{% include 'modular/abc.html.twig' with {'content' : page.find(/abc/_abc).content} %}
Which simply loads a particular modular template and sets the content to be the content from a particular page.